- selection can be extended by shift clicking
- clicking on the start of a selection clears it
This commit is contained in:
parent
355f26e2c8
commit
602af86e94
2 changed files with 8 additions and 3 deletions
|
|
@ -271,9 +271,13 @@ var Editor = function(renderer, doc) {
|
|||
var pos = this.renderer.screenToTextCoordinates(pageX, pageY);
|
||||
pos.row = Math.max(0, Math.min(pos.row, this.doc.getLength()-1));
|
||||
|
||||
this.moveCursorToPosition(pos);
|
||||
if (!this.$clickSelection)
|
||||
this.selection.setSelectionAnchor(pos.row, pos.column);
|
||||
if (e.shiftKey)
|
||||
this.selection.selectToPosition(pos)
|
||||
else {
|
||||
this.moveCursorToPosition(pos);
|
||||
if (!this.$clickSelection)
|
||||
this.selection.clearSelection(pos.row, pos.column);
|
||||
}
|
||||
|
||||
this.renderer.scrollCursorIntoView();
|
||||
|
||||
|
|
|
|||
|
|
@ -363,6 +363,7 @@ var Selection = function(doc) {
|
|||
this.moveCursorTo = function(row, column) {
|
||||
var cursor = this.$clipPositionToDocument(row, column);
|
||||
|
||||
// only dispatch change if the cursor actually changed
|
||||
if (cursor.row !== this.selectionLead.row || cursor.column !== this.selectionLead.column) {
|
||||
this.selectionLead = cursor;
|
||||
this.$dispatchEvent("changeCursor", { data: this.getCursor() });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue