NekoRectangle removal and replaced by RectangleSkin FeathersUI native class
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
package components;
|
||||
|
||||
import feathers.controls.ButtonState;
|
||||
import openfl.text.TextFormat;
|
||||
import model.Constants;
|
||||
import openfl.utils.Assets;
|
||||
import openfl.text.Font;
|
||||
import openfl.geom.ColorTransform;
|
||||
import openfl.display.Shape;
|
||||
import format.SVG;
|
||||
import feathers.controls.Button;
|
||||
|
||||
class CustomButton extends Button {
|
||||
|
||||
private var svgIconPath:String;
|
||||
private var svgIcon:Shape;
|
||||
private var upStateColor:Int;
|
||||
|
||||
public function new(pSvgIconPath:String = null, pUpstateColor:Int = 0x000000) {
|
||||
super();
|
||||
|
||||
svgIconPath = pSvgIconPath;
|
||||
upStateColor = pUpstateColor;
|
||||
}
|
||||
|
||||
override private function initialize():Void {
|
||||
super.initialize();
|
||||
|
||||
//iconPosition = TOP;
|
||||
embedFonts = true;
|
||||
backgroundSkin = new NekoRectangle(upStateColor);
|
||||
backgroundSkin.alpha = 0;
|
||||
|
||||
var fnt:Font = Assets.getFont(Constants.MONTSERRAT_LIGHT_300);
|
||||
textFormat = new TextFormat(fnt.fontName, 20, Constants.BUTTON_UP_COLOR);
|
||||
|
||||
svgIcon = new Shape();
|
||||
var ct = new ColorTransform();
|
||||
ct.color = 0xFFFFFF;
|
||||
svgIcon.transform.colorTransform = ct;
|
||||
new SVG(svgIconPath).render(svgIcon.graphics);
|
||||
icon = svgIcon;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package components;
|
||||
|
||||
import feathers.skins.RectangleSkin;
|
||||
import feathers.controls.Button;
|
||||
import format.SVG;
|
||||
import openfl.display.Bitmap;
|
||||
@@ -24,7 +25,8 @@ class IconButton extends Button {
|
||||
super.initialize();
|
||||
|
||||
iconPosition = TOP;
|
||||
backgroundSkin = new Bitmap(new BitmapData(10, 10, true, 0xFF00FF));
|
||||
//backgroundSkin = new Bitmap(new BitmapData(10, 10, true, 0xFF00FF));
|
||||
backgroundSkin = new RectangleSkin(SolidColor( 0xFF0000, 0));
|
||||
|
||||
// icon
|
||||
if(svgIconPath != null){
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package components;
|
||||
|
||||
import openfl.display.Shape;
|
||||
|
||||
class NekoRectangle extends Shape {
|
||||
public function new(pColor:Int = 0xFF0000, pX:Int = 0, pY:Int = 0, pWidth:Int = 10, pHeight:Int = 10) {
|
||||
super();
|
||||
|
||||
graphics.beginFill(pColor);
|
||||
graphics.drawRect(pX, pY, pWidth, pHeight);
|
||||
graphics.endFill();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
package components;
|
||||
|
||||
import feathers.controls.ToggleButton;
|
||||
import feathers.skins.RectangleSkin;
|
||||
import feathers.text.TextFormat;
|
||||
import format.SVG;
|
||||
import model.Constants;
|
||||
import openfl.display.Bitmap;
|
||||
import openfl.display.BitmapData;
|
||||
import openfl.display.Shape;
|
||||
import openfl.events.Event;
|
||||
import openfl.geom.ColorTransform;
|
||||
@@ -32,7 +31,7 @@ class ToolbarToggleButton extends ToggleButton {
|
||||
|
||||
iconPosition = TOP;
|
||||
embedFonts = true;
|
||||
backgroundSkin = new Bitmap(new BitmapData(10, 10, true, 0xFF00FF));
|
||||
backgroundSkin = new RectangleSkin(SolidColor( 0xFF0000, 0));
|
||||
|
||||
// icon
|
||||
if(svgIconPath != null){
|
||||
|
||||
Reference in New Issue
Block a user