Skip to content

Commit

Permalink
Fix inconsistent draw.update fires (#1160) (h/t @gynekolog)
Browse files Browse the repository at this point in the history
  • Loading branch information
gynekolog authored Mar 14, 2023
1 parent acd3500 commit ad44350
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/modes/direct_select.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,15 @@ DirectSelect.onMouseMove = function(state, e) {
// On mousemove that is not a drag, stop vertex movement.
const isFeature = isActiveFeature(e);
const onVertex = isVertex(e);
const isMidPoint = isMidpoint(e);
const noCoords = state.selectedCoordPaths.length === 0;
if (isFeature && noCoords) this.updateUIClasses({ mouse: Constants.cursors.MOVE });
else if (onVertex && !noCoords) this.updateUIClasses({ mouse: Constants.cursors.MOVE });
else this.updateUIClasses({ mouse: Constants.cursors.NONE });

const isDraggableItem = onVertex || isFeature || isMidPoint;
if (isDraggableItem && state.dragMoving) this.fireUpdate();

this.stopDragging(state);

// Skip render
Expand Down
5 changes: 4 additions & 1 deletion src/modes/simple_select.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ SimpleSelect.onStop = function() {
doubleClickZoom.enable(this);
};

SimpleSelect.onMouseMove = function(state) {
SimpleSelect.onMouseMove = function(state, e) {
const isFeature = CommonSelectors.isFeature(e);
if (isFeature && state.dragMoving) this.fireUpdate();

// On mousemove that is not a drag, stop extended interactions.
// This is useful if you drag off the canvas, release the button,
// then move the mouse back over the canvas --- we don't allow the
Expand Down

0 comments on commit ad44350

Please sign in to comment.