Image operations: update existing preview in new arrives

There was a bug:
1. insert very big image
2. rotate and quickly after that rotate again but hold
   mouse click so you will still see the preview
result: before patch preview was disappearing
        after patch preview is updated

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ieb343a371816fe14e4c65f862abf1e55bf36de1b
This commit is contained in:
Szymon Kłos 2022-02-03 19:05:56 +01:00 committed by Szymon Kłos
parent c1a08b4027
commit e64ff372fc
2 changed files with 13 additions and 0 deletions

View file

@ -1967,8 +1967,11 @@ L.CanvasTileLayer = L.Layer.extend({
if (extraInfo.id) {
this._map._cacheSVG[extraInfo.id] = textMsg;
}
var wasVisibleSVG = this._graphicMarker._hasVisibleEmbeddedSVG();
this._graphicMarker.removeEmbeddedSVG();
this._graphicMarker.addEmbeddedSVG(textMsg);
if (wasVisibleSVG)
this._graphicMarker._showEmbeddedSVG();
}
},

View file

@ -254,6 +254,16 @@ L.SVGGroup = L.Layer.extend({
});
},
_hasVisibleEmbeddedSVG: function () {
var result = false;
this._forEachSVGNode(function (svgNode) {
if (svgNode.getAttribute('opacity') !== 0)
result = true;
});
return result;
},
_transform: function(matrix) {
if (this._renderer) {
if (matrix) {