Permalink
Browse files

bugfix : prevent bugs when object size is null and scale value is 0

  • Loading branch information...
felipevex committed Sep 14, 2017
1 parent 5fa7412 commit b7dee49af75a5628636f102dd6237ef1c65b12a9
Showing with 9 additions and 5 deletions.
  1. +1 −1 README.md
  2. +8 −4 priori/view/PriDisplay.hx
View
@@ -34,7 +34,7 @@ Check the Priori api documentation ***under construction*** on (http://priori.tr
You can find some micro tutorials at Priori Blog: (http://priori.triture.com/blog)
## Installation
Requires [Haxe](http://haxe.org) 3.2.1+.
Requires [Haxe](http://haxe.org) 3.4.2+.
* **Step one:** install jQueryExtern lib via [haxelib](http://haxe.org/doc/haxelib/using_haxelib): `haxelib install jQueryExtern`
* **Step two:** install Priori lib: `haxelib install priori`
View
@@ -324,13 +324,17 @@ class PriDisplay extends PriEventDispatcher {
private function get_widthScaled():Float return this.width*this.dh.scaleX;
private function set_widthScaled(value:Float):Float {
this.scaleX = value / this.width;
var thisWidth:Float = this.width;
if (thisWidth != 0) this.scaleX = value / thisWidth;
return value;
}
private function get_heightScaled():Float return this.height*this.dh.scaleY;
private function set_heightScaled(value:Float):Float {
this.scaleY = value / this.height;
var thisHeight:Float = this.height;
if (thisHeight != 0) this.scaleY = value / thisHeight;
return value;
}
@@ -429,14 +433,14 @@ class PriDisplay extends PriEventDispatcher {
private function get_scaleX():Float return this.dh.scaleX;
private function set_scaleX(value:Float):Float {
this.dh.scaleX = value == null ? 1 : value;
this.dh.scaleX = value == null ? 1 : value == 0 ? 0.0001 : value;
DomHelper.apply2dTransformation(this.dh.jselement, this.dh.scaleX, this.dh.scaleY, this.dh.rotation, this.dh.anchorX, this.dh.anchorY);
return value;
}
private function get_scaleY():Float return this.dh.scaleY;
private function set_scaleY(value:Float):Float {
this.dh.scaleY = value == null ? 1 : value;
this.dh.scaleY = value == null ? 1 : value == 0 ? 0.0001 : value;
DomHelper.apply2dTransformation(this.dh.jselement, this.dh.scaleX, this.dh.scaleY, this.dh.rotation, this.dh.anchorX, this.dh.anchorY);
return value;
}

0 comments on commit b7dee49

Please sign in to comment.