diff --git a/lib/features/preview-support/PreviewSupport.js b/lib/features/preview-support/PreviewSupport.js index 9ce3d9851..4355bde95 100644 --- a/lib/features/preview-support/PreviewSupport.js +++ b/lib/features/preview-support/PreviewSupport.js @@ -61,11 +61,7 @@ export default function PreviewSupport(elementRegistry, eventBus, canvas, styles var self = this; eventBus.on('drag.cleanup', function() { - forEach(self._clonedMarkers, function(clonedMarker) { - svgRemove(clonedMarker); - }); - - self._clonedMarkers = {}; + self.cleanUp(); }); } @@ -76,6 +72,15 @@ PreviewSupport.$inject = [ 'styles' ]; +PreviewSupport.prototype.cleanUp = function() { + var self = this; + + forEach(self._clonedMarkers, function(clonedMarker) { + svgRemove(clonedMarker); + }); + + self._clonedMarkers = {}; +}; /** * Returns graphics of an element.