Skip to content

Commit 8c8f724

Browse files
committed
fix double click path vertices
1 parent ae24e27 commit 8c8f724

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/plots/cartesian/new_shape.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,26 +159,36 @@ function displayOutlines(polygons, outlines, dragOptions, nCalls) {
159159

160160
function removeVertex() {
161161
if(!polygons.length) return;
162+
var len = polygons[indexI].length;
163+
if(len < 3) return;
162164

163165
var newPolygon = [];
164-
for(var j = 0; j < polygons[indexI].length; j++) {
166+
for(var j = 0; j < len; j++) {
165167
if(j !== indexJ) {
166168
newPolygon.push(
167169
polygons[indexI][j]
168170
);
169171
}
170172
}
173+
174+
if(indexJ === 0) {
175+
newPolygon[indexI][0] = 'M';
176+
}
177+
171178
polygons[indexI] = newPolygon;
179+
180+
redraw();
172181
}
173182

174183
function clickVertexController(numClicks) {
175184
if(numClicks === 2) {
176185
var cell = polygons[indexI];
177-
if(cell.length > 4) {
186+
if(
187+
!pointsShapeRectangle(cell) &&
188+
!pointsShapeEllipse(cell)
189+
) {
178190
removeVertex();
179191
}
180-
181-
redraw();
182192
}
183193
}
184194

0 commit comments

Comments
 (0)