Don't change the skin ID when making a new one
This commit is contained in:
parent
29366df1d0
commit
fa12b523c9
@ -228,22 +228,18 @@ class RenderWebGL extends EventEmitter {
|
||||
* @param {!string} svgData - new SVG to use.
|
||||
* @param {?Array<number>} rotationCenter Optional: rotation center of the skin. If not supplied, the center of the
|
||||
* skin will be used
|
||||
* @returns {!int} the ID for the skin. This will be different from skinId if the old skin was not SVG.
|
||||
*/
|
||||
updateSVGSkin (skinId, svgData, rotationCenter) {
|
||||
if (this._allSkins[skinId] instanceof SVGSkin) {
|
||||
this._allSkins[skinId].setSVG(svgData, rotationCenter);
|
||||
return skinId;
|
||||
return;
|
||||
}
|
||||
|
||||
const newSkinId = this.createSVGSkin(svgData, rotationCenter);
|
||||
for (const drawable of this._allDrawables) {
|
||||
if (drawable && drawable.skin.id === skinId) {
|
||||
drawable.skin = this._allSkins[newSkinId];
|
||||
}
|
||||
}
|
||||
this.destroySkin(skinId);
|
||||
return newSkinId;
|
||||
const newSkin = new SVGSkin(skinId, this);
|
||||
newSkin.setSVG(svgData, rotationCenter);
|
||||
const oldSkin = this._allSkins[skinId];
|
||||
this._allSkins[skinId] = newSkin;
|
||||
oldSkin.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user