Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eb853ab

Browse files
committedApr 11, 2018
Fix drag cursor bug for shapes
- Bug revealed during review of #2193 - Bug: if a shape is not or not completely on screen at time of drag element setup, obtained bounding box would not be correct leading to the calculation of a wrong cursor once the shape scrolls into the viewport.
1 parent 3bf6abb commit eb853ab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎src/components/shapes/draw.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,17 @@ function setupDragElement(gd, shapePath, shapeOptions, index) {
138138
prepFn: startDrag,
139139
doneFn: endDrag
140140
},
141-
dragBBox = dragOptions.element.getBoundingClientRect(),
142141
dragMode;
143142

144143
dragElement.init(dragOptions);
145144

146145
shapePath.node().onmousemove = updateDragMode;
147146

148147
function updateDragMode(evt) {
148+
// element might not be on screen at time of setup,
149+
// so obtain bounding box here
150+
var dragBBox = dragOptions.element.getBoundingClientRect();
151+
149152
// choose 'move' or 'resize'
150153
// based on initial position of cursor within the drag element
151154
var w = dragBBox.right - dragBBox.left,

0 commit comments

Comments
 (0)
Please sign in to comment.