@@ -14,7 +14,6 @@ var dragHelpers = require('../../dragelement/helpers');
1414var drawMode = dragHelpers . drawMode ;
1515
1616var Registry = require ( '../../../registry' ) ;
17- var Lib = require ( '../../../lib' ) ;
1817var setCursor = require ( '../../../lib/setcursor' ) ;
1918
2019var 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