[skin] update ButtonColorSkin
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package haxework.gui.skin;
|
||||
|
||||
import flash.display.LineScaleMode;
|
||||
import flash.display.JointStyle;
|
||||
import flash.display.CapsStyle;
|
||||
import flash.display.Graphics;
|
||||
import haxework.color.ColorUtil;
|
||||
import haxework.gui.ButtonView.ButtonState;
|
||||
@@ -9,11 +12,13 @@ class ButtonColorSkin implements ISkin<ButtonView> {
|
||||
public var color(default, set):Int;
|
||||
public var alpha(default, default):Float;
|
||||
public var disable(default, default):Int;
|
||||
public var round(default, default):Float;
|
||||
private var colors:Map<ButtonState, Int>;
|
||||
|
||||
public function new(color:Int = 0xffffff, alpha:Float = 1.0) {
|
||||
public function new(color:Int = 0xffffff, alpha:Float = 1.0, round:Float = 15) {
|
||||
this.color = color;
|
||||
this.alpha = alpha;
|
||||
this.round = round;
|
||||
}
|
||||
|
||||
private function set_color(value:Int):Int {
|
||||
@@ -34,8 +39,8 @@ class ButtonColorSkin implements ISkin<ButtonView> {
|
||||
}
|
||||
var graphics:Graphics = view.content.graphics;
|
||||
graphics.beginFill(color, alpha);
|
||||
graphics.lineStyle(2, ColorUtil.multiply(color, 1.5));
|
||||
graphics.drawRoundRect(1, 1, view.width - 2, view.height - 2, 5, 5);
|
||||
graphics.lineStyle(2, ColorUtil.multiply(color, 1.5), 1, true, LineScaleMode.NONE, CapsStyle.ROUND, JointStyle.ROUND);
|
||||
graphics.drawRoundRect(1, 1, view.width - 2, view.height - 2, round, round);
|
||||
graphics.lineStyle();
|
||||
graphics.endFill();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user