Skip to content

Commit dffe308

Browse files
committed
Use 'grab' cursor when moving either end of a line shape [2038]
1 parent 88d959d commit dffe308

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

build/plotcss.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var rules = {
3030
"X .cursor-nw-resize": "cursor:nw-resize;",
3131
"X .cursor-n-resize": "cursor:n-resize;",
3232
"X .cursor-ne-resize": "cursor:ne-resize;",
33+
"X .cursor-grab": "cursor:-webkit-grab;cursor:grab;",
3334
"X .modebar": "position:absolute;top:2px;right:2px;z-index:1001;background:rgba(255,255,255,0.7);",
3435
"X .modebar--hover": "opacity:0;-webkit-transition:opacity 0.3s ease 0s;-moz-transition:opacity 0.3s ease 0s;-ms-transition:opacity 0.3s ease 0s;-o-transition:opacity 0.3s ease 0s;transition:opacity 0.3s ease 0s;",
3536
"X:hover .modebar--hover": "opacity:1;",

src/components/shapes/draw.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer) {
181181

182182
// Helper circles for resizing
183183
var circleStyle = {
184-
'cursor': 'default',
185184
'fill-opacity': '0' // ensure not visible
186185
};
187186
var circleRadius = sensoryWidth / 2 > minSensoryWidth ? sensoryWidth / 2 : minSensoryWidth;
@@ -193,7 +192,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer) {
193192
'cy': yPixelSized ? y2p(shapeOptions.yanchor) - shapeOptions.y0 : y2p(shapeOptions.y0),
194193
'r': circleRadius
195194
})
196-
.style(circleStyle);
195+
.style(circleStyle)
196+
.classed('cursor-grab', true);
197197

198198
g.append('circle')
199199
.attr({
@@ -202,7 +202,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer) {
202202
'cy': yPixelSized ? y2p(shapeOptions.yanchor) - shapeOptions.y1 : y2p(shapeOptions.y1),
203203
'r': circleRadius
204204
})
205-
.style(circleStyle);
205+
.style(circleStyle)
206+
.classed('cursor-grab', true);
206207

207208
return g;
208209
}

src/css/_cursor.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@
1414
.cursor-nw-resize { cursor: nw-resize; }
1515
.cursor-n-resize { cursor: n-resize; }
1616
.cursor-ne-resize { cursor: ne-resize; }
17+
.cursor-grab {
18+
cursor: -webkit-grab; // For Chrome
19+
cursor: grab;
20+
}

0 commit comments

Comments
 (0)