Forráskód Böngészése

group cache position needn't mutiple scale.

KK 8 éve
szülő
commit
bb0e9d137f

+ 1 - 1
canvas2D/src/Engine/babylon.canvas2d.ts

@@ -1536,7 +1536,7 @@
 
                 // Create a Sprite that will be used to render this cache, the "__cachedSpriteOfGroup__" starting id is a hack to bypass exception throwing in case of the Canvas doesn't normally allows direct primitives
                 else {
-                    sprite = new Sprite2D(map, { parent: parent, id: `__cachedSpriteOfGroup__${group.id}`, x: group.actualPosition.x * scale.x, y: group.actualPosition.y * scale.y, spriteSize: originalSize, spriteLocation: node.pos, dontInheritParentScale: true });
+                    sprite = new Sprite2D(map, { parent: parent, id: `__cachedSpriteOfGroup__${group.id}`, x: group.actualPosition.x, y: group.actualPosition.y, spriteSize: originalSize, spriteLocation: node.pos, dontInheritParentScale: true });
                     sprite.origin = group.origin.clone();
                     sprite.addExternalData("__cachedGroup__", group);
                     sprite.pointerEventObservable.add((e, s) => {

+ 1 - 12
canvas2D/src/Engine/babylon.group2d.ts

@@ -917,23 +917,12 @@
             // For now we only support these property changes
             // TODO: add more! :)
             switch (prop.id) {
-                case Prim2DBase.actualScaleProperty.id:
                 case Prim2DBase.actualPositionProperty.id:
-                    let noResizeScale = rd._noResizeOnScale;
-                    let isCanvas = parent == null;
-                    let scale: Vector2;
-                    if (noResizeScale) {
-                        scale = isCanvas ? Group2D._unS : this.parent.actualScale;
-                    } else {
-                        scale = this.actualScale;
-                    }
-
-                    cachedSprite.actualPosition = this.actualPosition.multiply(scale);
+                    cachedSprite.actualPosition = this.actualPosition.clone();
                     if (cachedSprite.position != null) {
                         cachedSprite.position = cachedSprite.actualPosition.clone();
                     }
                     break;
-
                 case Prim2DBase.rotationProperty.id:
                     cachedSprite.rotation = this.rotation;
                     break;