dikalo/lienzo-core

AlignAndDistribute cannot handle addShape & removeShape when a shape is not draggable

helmutprovost opened this issue · 1 comments

With this code we get a NullPointerException on
alignAndDistribute.removeShape(shape);
coming from
AlignAndDistribute.AlignAndDistributeHandler@removeDragHandlerRegistrations()
m_dragEndHandlerReg has never been initialized, yet
m_dragEndHandlerReg.removeHandler(); is called.
Note that the shape has not been set to draggable when adding it to the alignAndDistribute.

Layer layer = ...;
Shape shape = ...;
AlignAndDistribute alignAndDistribute = new AlignAndDistribute(layer) ;
alignAndDistribute.addShape(shape);
alignAndDistribute.removeShape(shape);

Javascript stacktrace:
SEVERE: (TypeError) : Cannot read property 'removeHandler' of undefinedcom.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read property 'removeHandler' of undefined
at Unknown.removeDragHandlerRegistrations(wfviewer-0.js@27:12767)
at Unknown.removeHandlerRegistrations(wfviewer-0.js@8:12774)
at Unknown.removeShape(wfviewer-0.js@11:12391)

@mdproctor

will look into it...