Commit f1642892 authored by Viktor Lidholt's avatar Viktor Lidholt

Fixes SpriteBox to work better with native points

parent 79ec7454
...@@ -32,8 +32,10 @@ class SpriteBox extends RenderBox { ...@@ -32,8 +32,10 @@ class SpriteBox extends RenderBox {
if (value == _rootNode) return; if (value == _rootNode) return;
// Ensure that the root node has a size // Ensure that the root node has a size
assert(value.size.width > 0); assert(_transformMode == SpriteBoxTransformMode.nativePoints
assert(value.size.height > 0); || value.size.width > 0);
assert(_transformMode == SpriteBoxTransformMode.nativePoints
|| value.size.height > 0);
// Remove sprite box references // Remove sprite box references
if (_rootNode != null) _removeSpriteBoxReference(_rootNode); if (_rootNode != null) _removeSpriteBoxReference(_rootNode);
...@@ -101,11 +103,11 @@ class SpriteBox extends RenderBox { ...@@ -101,11 +103,11 @@ class SpriteBox extends RenderBox {
assert(rootNode != null); assert(rootNode != null);
assert(rootNode._spriteBox == null); assert(rootNode._spriteBox == null);
// Setup root node
this.rootNode = rootNode;
// Setup transform mode // Setup transform mode
this.transformMode = mode; this.transformMode = mode;
// Setup root node
this.rootNode = rootNode;
} }
void _removeSpriteBoxReference(Node node) { void _removeSpriteBoxReference(Node node) {
...@@ -310,6 +312,8 @@ class SpriteBox extends RenderBox { ...@@ -310,6 +312,8 @@ class SpriteBox extends RenderBox {
rootNode.size = new Size(systemWidth, systemHeight); rootNode.size = new Size(systemWidth, systemHeight);
break; break;
case SpriteBoxTransformMode.nativePoints: case SpriteBoxTransformMode.nativePoints:
systemWidth = size.width;
systemHeight = size.height;
break; break;
default: default:
assert(false); assert(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment