mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 23:12:24 -05:00
Add updating the rotation center to updateSvg
This commit is contained in:
parent
5606b067e5
commit
29540e705e
1 changed files with 4 additions and 7 deletions
|
@ -380,15 +380,12 @@ class VirtualMachine extends EventEmitter {
|
||||||
* @param {int} costumeIndex - the index of the costume to be updated.
|
* @param {int} costumeIndex - the index of the costume to be updated.
|
||||||
* @param {string} svg - new SVG for the renderer.
|
* @param {string} svg - new SVG for the renderer.
|
||||||
*/
|
*/
|
||||||
updateSvg (costumeIndex, svg) {
|
updateSvg (costumeIndex, svg, rotationCenterX, rotationCenterY) {
|
||||||
const costume = this.editingTarget.sprite.costumes[costumeIndex];
|
const costume = this.editingTarget.sprite.costumes[costumeIndex];
|
||||||
|
costume.rotationCenterX = rotationCenterX;
|
||||||
|
costume.rotationCenterY = rotationCenterY;
|
||||||
if (costume && this.runtime && this.runtime.renderer) {
|
if (costume && this.runtime && this.runtime.renderer) {
|
||||||
const rotationCenter = [
|
this.runtime.renderer.updateSVGSkin(costume.skinId, svg, [rotationCenterX, rotationCenterY]);
|
||||||
costume.rotationCenterX / costume.bitmapResolution,
|
|
||||||
costume.rotationCenterY / costume.bitmapResolution
|
|
||||||
];
|
|
||||||
|
|
||||||
this.runtime.renderer.updateSVGSkin(costume.skinId, svg, rotationCenter);
|
|
||||||
}
|
}
|
||||||
// @todo: Also update storage in addition to renderer. Without storage, if you switch
|
// @todo: Also update storage in addition to renderer. Without storage, if you switch
|
||||||
// costumes and switch back, you will lose your changes in the paint editor.
|
// costumes and switch back, you will lose your changes in the paint editor.
|
||||||
|
|
Loading…
Reference in a new issue