Skip to content

Commit

Permalink
Fix selection in selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Doichin Lazarov committed Sep 8, 2016
1 parent f1f9f61 commit d4d074f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,2 +1,5 @@
node_modules
dist/openseadragonselection.js.map
/nbproject/private/
/nbproject/project.xml
/nbproject/project.properties
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -60,3 +60,6 @@ Then you can alter the selection state with any of these:

- fix behavior when the viewer itself is rotated
- test/fix with multiple images at once

## Fixes
- Now selection can be draw over existing selections, make selection in selection. To achieve that before you were forced to make a selection outside any other selection and move it over.
6 changes: 5 additions & 1 deletion src/selection.js
Expand Up @@ -152,7 +152,7 @@
});

this.outerTracker = new $.MouseTracker({
element: this.viewer.drawer.canvas,
element: this.viewer.canvas,
clickTimeThreshold: this.viewer.clickTimeThreshold,
clickDistThreshold: this.viewer.clickDistThreshold,
dragHandler: $.delegate( this, onOutsideDrag ),
Expand Down Expand Up @@ -316,6 +316,8 @@
});

function onOutsideDrag(e) {
// Disable move when makeing new selection
this.viewer.setMouseNavEnabled(false);
var delta = this.viewer.viewport.deltaPointsFromPixels(e.delta, true);
var end = this.viewer.viewport.pointFromPixel(e.position, true);
var start = new $.Point(end.x - delta.x, end.y - delta.y);
Expand Down Expand Up @@ -359,6 +361,8 @@
}

function onOutsideDragEnd() {
// Eable move after new selection is done
this.viewer.setMouseNavEnabled(true);
this.rectDone = true;
}

Expand Down

0 comments on commit d4d074f

Please sign in to comment.