[view] fix ImageView color

This commit is contained in:
2019-03-28 17:38:09 +03:00
parent 22e7894c03
commit d55201ecc0

View File

@@ -15,6 +15,7 @@ class ImageView extends SpriteView {
public var fillType(default, set):FillType; public var fillType(default, set):FillType;
private var bitmapSkin:BitmapSkin = new BitmapSkin(); private var bitmapSkin:BitmapSkin = new BitmapSkin();
private var coloredImage:BitmapData;
public function new(image:BitmapData = null) { public function new(image:BitmapData = null) {
super(); super();
@@ -34,9 +35,9 @@ class ImageView extends SpriteView {
if (image != value) { if (image != value) {
image = value; image = value;
if (color > -1) { if (color > -1) {
image = BitmapUtil.colorize(image, color); coloredImage = BitmapUtil.colorize(image, color);
} }
bitmapSkin.image = image; bitmapSkin.image = coloredImage == null ? image : coloredImage;
toRedraw(); toRedraw();
} }
return image; return image;
@@ -64,9 +65,10 @@ class ImageView extends SpriteView {
if (color != value) { if (color != value) {
color = value; color = value;
if (image != null) { if (image != null) {
image = BitmapUtil.colorize(image, color); coloredImage = BitmapUtil.colorize(image, color);
toRedraw(); bitmapSkin.image = coloredImage;
} }
toRedraw();
} }
return color; return color;
} }