From d55201ecc0494ba24af049bd319a3df50240f381 Mon Sep 17 00:00:00 2001 From: shmyga Date: Thu, 28 Mar 2019 17:38:09 +0300 Subject: [PATCH] [view] fix ImageView color --- src/main/haxework/view/ImageView.hx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/haxework/view/ImageView.hx b/src/main/haxework/view/ImageView.hx index 63d3c60..f678dff 100755 --- a/src/main/haxework/view/ImageView.hx +++ b/src/main/haxework/view/ImageView.hx @@ -15,6 +15,7 @@ class ImageView extends SpriteView { public var fillType(default, set):FillType; private var bitmapSkin:BitmapSkin = new BitmapSkin(); + private var coloredImage:BitmapData; public function new(image:BitmapData = null) { super(); @@ -34,9 +35,9 @@ class ImageView extends SpriteView { if (image != value) { image = value; if (color > -1) { - image = BitmapUtil.colorize(image, color); + coloredImage = BitmapUtil.colorize(image, color); } - bitmapSkin.image = image; + bitmapSkin.image = coloredImage == null ? image : coloredImage; toRedraw(); } return image; @@ -64,9 +65,10 @@ class ImageView extends SpriteView { if (color != value) { color = value; if (image != null) { - image = BitmapUtil.colorize(image, color); - toRedraw(); + coloredImage = BitmapUtil.colorize(image, color); + bitmapSkin.image = coloredImage; } + toRedraw(); } return color; }