Skip to content

Commit a585394

Browse files
committed
rename new dragmodes as well as modebar button names
1 parent 1106180 commit a585394

File tree

8 files changed

+58
-58
lines changed

8 files changed

+58
-58
lines changed

src/components/dragelement/helpers.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,35 @@ exports.selectMode = function(dragmode) {
1717

1818
exports.drawMode = function(dragmode) {
1919
return (
20-
dragmode === 'closedfreedraw' ||
21-
dragmode === 'openfreedraw' ||
22-
dragmode === 'linedraw' ||
23-
dragmode === 'rectdraw' ||
24-
dragmode === 'ellipsedraw'
20+
dragmode === 'drawclosedpath' ||
21+
dragmode === 'drawopenpath' ||
22+
dragmode === 'drawline' ||
23+
dragmode === 'drawrect' ||
24+
dragmode === 'drawcircle'
2525
);
2626
};
2727

2828
exports.openMode = function(dragmode) {
2929
return (
30-
dragmode === 'linedraw' ||
31-
dragmode === 'openfreedraw'
30+
dragmode === 'drawline' ||
31+
dragmode === 'drawopenpath'
3232
);
3333
};
3434

3535
exports.rectMode = function(dragmode) {
3636
return (
3737
dragmode === 'select' ||
38-
dragmode === 'linedraw' ||
39-
dragmode === 'rectdraw' ||
40-
dragmode === 'ellipsedraw'
38+
dragmode === 'drawline' ||
39+
dragmode === 'drawrect' ||
40+
dragmode === 'drawcircle'
4141
);
4242
};
4343

4444
exports.freeMode = function(dragmode) {
4545
return (
4646
dragmode === 'lasso' ||
47-
dragmode === 'closedfreedraw' ||
48-
dragmode === 'openfreedraw'
47+
dragmode === 'drawclosedpath' ||
48+
dragmode === 'drawopenpath'
4949
);
5050
};
5151

src/components/fx/layout_attributes.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ module.exports = {
4949
'pan',
5050
'select',
5151
'lasso',
52-
'closedfreedraw',
53-
'openfreedraw',
54-
'linedraw',
55-
'rectdraw',
56-
'ellipsedraw',
52+
'drawclosedpath',
53+
'drawopenpath',
54+
'drawline',
55+
'drawrect',
56+
'drawcircle',
5757
'orbit',
5858
'turntable',
5959
false

src/components/modebar/buttons.js

+20-20
Original file line numberDiff line numberDiff line change
@@ -134,48 +134,48 @@ modeBarButtons.lasso2d = {
134134
click: handleCartesian
135135
};
136136

137-
modeBarButtons.closedfreedraw = {
138-
name: 'closedfreedraw',
137+
modeBarButtons.drawclosedpath = {
138+
name: 'drawclosedpath',
139139
title: function(gd) { return _(gd, 'Draw Closed Freeform'); },
140140
attr: 'dragmode',
141-
val: 'closedfreedraw',
142-
icon: Icons.closedfreedraw,
141+
val: 'drawclosedpath',
142+
icon: Icons.drawclosedpath,
143143
click: handleCartesian
144144
};
145145

146-
modeBarButtons.openfreedraw = {
147-
name: 'openfreedraw',
146+
modeBarButtons.drawopenpath = {
147+
name: 'drawopenpath',
148148
title: function(gd) { return _(gd, 'Draw Open Freeform'); },
149149
attr: 'dragmode',
150-
val: 'openfreedraw',
151-
icon: Icons.openfreedraw,
150+
val: 'drawopenpath',
151+
icon: Icons.drawopenpath,
152152
click: handleCartesian
153153
};
154154

155-
modeBarButtons.linedraw = {
156-
name: 'linedraw',
155+
modeBarButtons.drawline = {
156+
name: 'drawline',
157157
title: function(gd) { return _(gd, 'Draw Line'); },
158158
attr: 'dragmode',
159-
val: 'linedraw',
160-
icon: Icons.linedraw,
159+
val: 'drawline',
160+
icon: Icons.drawline,
161161
click: handleCartesian
162162
};
163163

164-
modeBarButtons.rectdraw = {
165-
name: 'rectdraw',
164+
modeBarButtons.drawrect = {
165+
name: 'drawrect',
166166
title: function(gd) { return _(gd, 'Draw Rectangle'); },
167167
attr: 'dragmode',
168-
val: 'rectdraw',
169-
icon: Icons.rectdraw,
168+
val: 'drawrect',
169+
icon: Icons.drawrect,
170170
click: handleCartesian
171171
};
172172

173-
modeBarButtons.ellipsedraw = {
174-
name: 'ellipsedraw',
173+
modeBarButtons.drawcircle = {
174+
name: 'drawcircle',
175175
title: function(gd) { return _(gd, 'Draw Ellipse'); },
176176
attr: 'dragmode',
177-
val: 'ellipsedraw',
178-
icon: Icons.ellipsedraw,
177+
val: 'drawcircle',
178+
icon: Icons.drawcircle,
179179
click: handleCartesian
180180
};
181181

src/components/modebar/manage.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ function getButtonGroups(gd) {
176176
fullLayout._has('cartesian')
177177
) {
178178
dragModeGroup.push(
179-
'linedraw',
180-
'openfreedraw',
181-
'closedfreedraw',
182-
'ellipsedraw',
183-
'rectdraw',
179+
'drawline',
180+
'drawopenpath',
181+
'drawclosedpath',
182+
'drawcircle',
183+
'drawrect',
184184
'eraseshape'
185185
);
186186
}

src/fonts/ploticon.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ module.exports = {
111111
'path': 'm214-7h429v214h-429v-214z m500 0h72v500q0 8-6 21t-11 20l-157 156q-5 6-19 12t-22 5v-232q0-22-15-38t-38-16h-322q-22 0-37 16t-16 38v232h-72v-714h72v232q0 22 16 38t37 16h465q22 0 38-16t15-38v-232z m-214 518v178q0 8-5 13t-13 5h-107q-7 0-13-5t-5-13v-178q0-8 5-13t13-5h107q7 0 13 5t5 13z m357-18v-518q0-22-15-38t-38-16h-750q-23 0-38 16t-16 38v750q0 22 16 38t38 16h517q23 0 50-12t42-26l156-157q16-15 27-42t11-49z',
112112
'transform': 'matrix(1 0 0 -1 0 850)'
113113
},
114-
'openfreedraw': {
114+
'drawopenpath': {
115115
'width': 70,
116116
'height': 70,
117117
'path': 'M33.21,85.65a7.31,7.31,0,0,1-2.59-.48c-8.16-3.11-9.27-19.8-9.88-41.3-.1-3.58-.19-6.68-.35-9-.15-2.1-.67-3.48-1.43-3.79-2.13-.88-7.91,2.32-12,5.86L3,32.38c1.87-1.64,11.55-9.66,18.27-6.9,2.13.87,4.75,3.14,5.17,9,.17,2.43.26,5.59.36,9.25a224.17,224.17,0,0,0,1.5,23.4c1.54,10.76,4,12.22,4.48,12.4.84.32,2.79-.46,5.76-3.59L43,80.07C41.53,81.57,37.68,85.64,33.21,85.65ZM74.81,69a11.34,11.34,0,0,0,6.09-6.72L87.26,44.5,74.72,32,56.9,38.35c-2.37.86-5.57,3.42-6.61,6L38.65,72.14l8.42,8.43ZM55,46.27a7.91,7.91,0,0,1,3.64-3.17l14.8-5.3,8,8L76.11,60.6l-.06.19a6.37,6.37,0,0,1-3,3.43L48.25,74.59,44.62,71Zm16.57,7.82A6.9,6.9,0,1,0,64.64,61,6.91,6.91,0,0,0,71.54,54.09Zm-4.05,0a2.85,2.85,0,1,1-2.85-2.85A2.86,2.86,0,0,1,67.49,54.09Zm-4.13,5.22L60.5,56.45,44.26,72.7l2.86,2.86ZM97.83,35.67,84.14,22l-8.57,8.57L89.26,44.24Zm-13.69-8,8,8-2.85,2.85-8-8Z',
118118
'transform': 'matrix(1 0 0 1 -15 -15)'
119119
},
120-
'closedfreedraw': {
120+
'drawclosedpath': {
121121
'width': 90,
122122
'height': 90,
123123
'path': 'M88.41,21.12a26.56,26.56,0,0,0-36.18,0l-2.07,2-2.07-2a26.57,26.57,0,0,0-36.18,0,23.74,23.74,0,0,0,0,34.8L48,90.12a3.22,3.22,0,0,0,4.42,0l36-34.21a23.73,23.73,0,0,0,0-34.79ZM84,51.24,50.16,83.35,16.35,51.25a17.28,17.28,0,0,1,0-25.47,20,20,0,0,1,27.3,0l4.29,4.07a3.23,3.23,0,0,0,4.44,0l4.29-4.07a20,20,0,0,1,27.3,0,17.27,17.27,0,0,1,0,25.46ZM66.76,47.68h-33v6.91h33ZM53.35,35H46.44V68h6.91Z',
@@ -135,19 +135,19 @@ module.exports = {
135135
'path': 'm0 850l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-285l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z',
136136
'transform': 'matrix(1 0 0 -1 0 850)'
137137
},
138-
'linedraw': {
138+
'drawline': {
139139
'width': 70,
140140
'height': 70,
141141
'path': 'M60.64,62.3a11.29,11.29,0,0,0,6.09-6.72l6.35-17.72L60.54,25.31l-17.82,6.4c-2.36.86-5.57,3.41-6.6,6L24.48,65.5l8.42,8.42ZM40.79,39.63a7.89,7.89,0,0,1,3.65-3.17l14.79-5.31,8,8L61.94,54l-.06.19a6.44,6.44,0,0,1-3,3.43L34.07,68l-3.62-3.63Zm16.57,7.81a6.9,6.9,0,1,0-6.89,6.9A6.9,6.9,0,0,0,57.36,47.44Zm-4,0a2.86,2.86,0,1,1-2.85-2.85A2.86,2.86,0,0,1,53.32,47.44Zm-4.13,5.22L46.33,49.8,30.08,66.05l2.86,2.86ZM83.65,29,70,15.34,61.4,23.9,75.09,37.59ZM70,21.06l8,8-2.84,2.85-8-8ZM87,80.49H10.67V87H87Z',
142142
'transform': 'matrix(1 0 0 1 -15 -15)'
143143
},
144-
'rectdraw': {
144+
'drawrect': {
145145
'width': 80,
146146
'height': 80,
147147
'path': 'M78,22V79H21V22H78m9-9H12V88H87V13ZM68,46.22H31V54H68ZM53,32H45.22V69H53Z',
148148
'transform': 'matrix(1 0 0 1 -10 -10)'
149149
},
150-
'ellipsedraw': {
150+
'drawcircle': {
151151
'width': 80,
152152
'height': 80,
153153
'path': 'M50,84.72C26.84,84.72,8,69.28,8,50.3S26.84,15.87,50,15.87,92,31.31,92,50.3,73.16,84.72,50,84.72Zm0-60.59c-18.6,0-33.74,11.74-33.74,26.17S31.4,76.46,50,76.46,83.74,64.72,83.74,50.3,68.6,24.13,50,24.13Zm17.15,22h-34v7.11h34Zm-13.8-13H46.24v34h7.11Z',

src/plots/cartesian/new_shape.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -645,20 +645,20 @@ function addNewShapes(outlines, dragOptions) {
645645
if(id < gd._fullLayout.shapes.length) {
646646
switch(gd._fullLayout.shapes[id].type) {
647647
case 'rect':
648-
dragmode = 'rectdraw';
648+
dragmode = 'drawrect';
649649
break;
650650
case 'circle':
651-
dragmode = 'ellipsedraw';
651+
dragmode = 'drawcircle';
652652
break;
653653
case 'line':
654-
dragmode = 'linedraw';
654+
dragmode = 'drawline';
655655
break;
656656
case 'path':
657657
var path = gd._fullLayout.shapes[id].path || '';
658658
if(path[path.length - 1] === 'Z') {
659-
dragmode = 'closedfreedraw';
659+
dragmode = 'drawclosedpath';
660660
} else {
661-
dragmode = 'openfreedraw';
661+
dragmode = 'drawopenpath';
662662
}
663663
break;
664664
}
@@ -695,7 +695,7 @@ function addNewShapes(outlines, dragOptions) {
695695
}
696696

697697
if(
698-
dragmode === 'rectdraw' &&
698+
dragmode === 'drawrect' &&
699699
pointsShapeRectangle(cell)
700700
) {
701701
shape.type = 'rect';
@@ -704,15 +704,15 @@ function addNewShapes(outlines, dragOptions) {
704704
shape.x1 = cell[2][1];
705705
shape.y1 = cell[2][2];
706706
} else if(
707-
dragmode === 'linedraw'
707+
dragmode === 'drawline'
708708
) {
709709
shape.type = 'line';
710710
shape.x0 = cell[0][1];
711711
shape.y0 = cell[0][2];
712712
shape.x1 = cell[1][1];
713713
shape.y1 = cell[1][2];
714714
} else if(
715-
dragmode === 'ellipsedraw' &&
715+
dragmode === 'drawcircle' &&
716716
(isActiveShape === false || pointsShapeEllipse(cell))
717717
) {
718718
shape.type = 'circle'; // an ellipse!

src/plots/cartesian/select.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ function prepSelect(e, startX, startY, dragOptions, mode) {
5959
var isDrawMode = drawMode(mode);
6060
var isSelectMode = selectMode(mode);
6161

62-
var isLine = mode === 'linedraw';
63-
var isEllipse = mode === 'ellipsedraw';
62+
var isLine = mode === 'drawline';
63+
var isEllipse = mode === 'drawcircle';
6464
var isLineOrEllipse = isLine || isEllipse; // cases with two start & end positions
6565

6666
var gd = dragOptions.gd;

src/plots/layout_attributes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ module.exports = {
514514
dflt: 'diagonal',
515515
editType: 'none',
516516
description: [
517-
'When `dragmode` is set to *rectdraw*, *linedraw* or *ellipsedraw*',
517+
'When `dragmode` is set to *drawrect*, *drawline* or *drawcircle*',
518518
'this limits the drag to be horizontal, vertical or diagonal.',
519519
'Using *diagonal* there is no limit e.g. in drawing lines in any direction.',
520520
'*ortho* limits the draw to be either horizontal or vertical.',

0 commit comments

Comments
 (0)