Skip to content

Commit c5ff5df

Browse files
committed
revise outline updates in shape eidts
- record outline positions only on activeshapes and at init time - call update on end drags
1 parent a824d85 commit c5ff5df

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/components/shapes/draw_newshape/display_outlines.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ var dragHelpers = require('../../dragelement/helpers');
1414
var drawMode = dragHelpers.drawMode;
1515

1616
var Registry = require('../../../registry');
17-
var Lib = require('../../../lib');
1817
var setCursor = require('../../../lib/setcursor');
1918

2019
var MINSELECT = require('../../../plots/cartesian/constants').MINSELECT;
@@ -42,10 +41,17 @@ module.exports = function displayOutlines(polygons, outlines, dragOptions, nCall
4241
// recursive call
4342
displayOutlines(polygons, outlines, dragOptions, nCalls++);
4443

44+
if(pointsShapeEllipse(polygons[0])) {
45+
update({redrawing: true});
46+
}
47+
}
48+
49+
function update(opts) {
4550
dragOptions.isActiveShape = false; // i.e. to disable controllers
51+
4652
var shapes = newShapes(outlines, dragOptions);
4753
if(shapes) {
48-
Registry.call('_guiRelayout', gd, {
54+
Registry.call(opts && opts.redrawing ? 'relayout' : '_guiRelayout', gd, {
4955
shapes: shapes // update active shape
5056
});
5157
}
@@ -75,9 +81,9 @@ module.exports = function displayOutlines(polygons, outlines, dragOptions, nCall
7581
var indexJ; // vertex or cell-controller index
7682
var copyPolygons;
7783

78-
copyPolygons = recordPositions([], polygons);
79-
8084
if(isActiveShape) {
85+
if(!nCalls) copyPolygons = recordPositions([], polygons);
86+
8187
var g = zoomLayer.append('g').attr('class', 'outline-controllers');
8288
addVertexControllers(g);
8389
addShapeControllers();
@@ -133,8 +139,8 @@ module.exports = function displayOutlines(polygons, outlines, dragOptions, nCall
133139
redraw();
134140
}
135141

136-
function endDragVertexController(evt) {
137-
Lib.noop(evt);
142+
function endDragVertexController() {
143+
update();
138144
}
139145

140146
function removeVertex() {
@@ -307,8 +313,8 @@ module.exports = function displayOutlines(polygons, outlines, dragOptions, nCall
307313
shapeDragOptions[indexI].moveFn = moveShapeController;
308314
}
309315

310-
function endDragShapeController(evt) {
311-
Lib.noop(evt);
316+
function endDragShapeController() {
317+
update();
312318
}
313319

314320
function addShapeControllers() {

0 commit comments

Comments
 (0)