@flashist/appframework 0.0.62 → 0.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
import { IFLabelConfig } from "@flashist/flibs";
|
|
2
2
|
export interface ISimpleButtonConfig {
|
|
3
|
-
bgConfig?: {
|
|
4
|
-
image?: {
|
|
5
|
-
imageId: string;
|
|
6
|
-
};
|
|
7
|
-
vector?: {
|
|
8
|
-
bgColor: number;
|
|
9
|
-
overBgColor: number;
|
|
10
|
-
bgAlpha: number;
|
|
11
|
-
bgBorderColor: number;
|
|
12
|
-
bgBorderAlpha: number;
|
|
13
|
-
bgBorderWidth: number;
|
|
14
|
-
};
|
|
15
|
-
resizeBg?: boolean;
|
|
16
|
-
};
|
|
17
3
|
labelConfig?: IFLabelConfig;
|
|
18
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FContainer, FLabel
|
|
1
|
+
import { FContainer, FLabel } from "@flashist/flibs";
|
|
2
2
|
import { ISimpleButtonConfig } from "./ISimpleButtonConfig";
|
|
3
3
|
import { ResizableContainer } from "../resize/ResizableContainer";
|
|
4
4
|
import { IToggableItem } from "../togglegroup/IToggableItem";
|
|
@@ -9,7 +9,6 @@ export declare class SimpleButtonView<DataType extends object = object> extends
|
|
|
9
9
|
protected _selected: boolean;
|
|
10
10
|
protected config: ISimpleButtonConfig;
|
|
11
11
|
protected contentCont: FContainer;
|
|
12
|
-
protected bg: Graphics | Sprite;
|
|
13
12
|
protected label: FLabel;
|
|
14
13
|
constructor(config: ISimpleButtonConfig);
|
|
15
14
|
protected construction(config: ISimpleButtonConfig): void;
|
|
@@ -28,6 +27,4 @@ export declare class SimpleButtonView<DataType extends object = object> extends
|
|
|
28
27
|
get selected(): boolean;
|
|
29
28
|
set selected(value: boolean);
|
|
30
29
|
protected findStateValue(normalState: string): string;
|
|
31
|
-
protected createBg(): Sprite | Graphics;
|
|
32
|
-
protected updateBg(): void;
|
|
33
30
|
}
|
|
@@ -13,7 +13,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
13
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
14
|
};
|
|
15
15
|
})();
|
|
16
|
-
import { FContainer, FLabel,
|
|
16
|
+
import { FContainer, FLabel, InteractiveEvent } from "@flashist/flibs";
|
|
17
17
|
import { SimpleButtonState } from "./SimpleButtonState";
|
|
18
18
|
import { ResizableContainer } from "../resize/ResizableContainer";
|
|
19
19
|
var SimpleButtonView = /** @class */ (function (_super) {
|
|
@@ -22,23 +22,25 @@ var SimpleButtonView = /** @class */ (function (_super) {
|
|
|
22
22
|
return _super.call(this, config) || this;
|
|
23
23
|
}
|
|
24
24
|
SimpleButtonView.prototype.construction = function (config) {
|
|
25
|
-
var _a;
|
|
26
25
|
_super.prototype.construction.call(this);
|
|
27
26
|
this.config = config;
|
|
28
27
|
this.contentCont = new FContainer();
|
|
29
28
|
this.addChild(this.contentCont);
|
|
30
|
-
this.bg = this.createBg();
|
|
31
|
-
this.contentCont.addChild(this.bg);
|
|
29
|
+
// this.bg = this.createBg();
|
|
30
|
+
// this.contentCont.addChild(this.bg);
|
|
32
31
|
this.label = new FLabel(this.config.labelConfig);
|
|
33
32
|
this.contentCont.addChild(this.label);
|
|
34
33
|
//
|
|
35
|
-
this.label.interactive =
|
|
36
|
-
this.label.interactiveChildren =
|
|
34
|
+
this.label.interactive = true;
|
|
35
|
+
this.label.interactiveChildren = true;
|
|
37
36
|
this.state = SimpleButtonState.NORMAL;
|
|
38
37
|
this.enabled = true;
|
|
39
|
-
if (!
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
// if (!this.config.bgConfig?.resizeBg) {
|
|
39
|
+
// this.resize(
|
|
40
|
+
// this.bg.width,
|
|
41
|
+
// this.bg.height
|
|
42
|
+
// );
|
|
43
|
+
// }
|
|
42
44
|
};
|
|
43
45
|
SimpleButtonView.prototype.addListeners = function () {
|
|
44
46
|
_super.prototype.addListeners.call(this);
|
|
@@ -59,18 +61,17 @@ var SimpleButtonView = /** @class */ (function (_super) {
|
|
|
59
61
|
// this.onOut();
|
|
60
62
|
};
|
|
61
63
|
SimpleButtonView.prototype.arrange = function () {
|
|
62
|
-
var _a;
|
|
63
64
|
_super.prototype.arrange.call(this);
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
this.label.width = this.bg.width;
|
|
71
|
-
this.label.height = this.bg.height;
|
|
72
|
-
this.label.x = this.bg.x + Math.floor((this.bg.width - this.label.width) / 2);
|
|
73
|
-
this.label.y = this.bg.y + Math.floor((this.bg.height - this.label.height) / 2);
|
|
65
|
+
// if (this.config.bgConfig?.resizeBg) {
|
|
66
|
+
// if (this.bg.width !== this.resizeSize.x ||
|
|
67
|
+
// this.bg.height !== this.resizeSize.y) {
|
|
68
|
+
// this.updateBg();
|
|
69
|
+
// }
|
|
70
|
+
// }
|
|
71
|
+
// this.label.width = this.bg.width;
|
|
72
|
+
// this.label.height = this.bg.height;
|
|
73
|
+
// this.label.x = this.bg.x + Math.floor((this.bg.width - this.label.width) / 2);
|
|
74
|
+
// this.label.y = this.bg.y + Math.floor((this.bg.height - this.label.height) / 2);
|
|
74
75
|
};
|
|
75
76
|
Object.defineProperty(SimpleButtonView.prototype, "enabled", {
|
|
76
77
|
get: function () {
|
|
@@ -121,7 +122,7 @@ var SimpleButtonView = /** @class */ (function (_super) {
|
|
|
121
122
|
this.interactive = false;
|
|
122
123
|
this.alpha = 0.5;
|
|
123
124
|
}
|
|
124
|
-
this.updateBg();
|
|
125
|
+
// this.updateBg();
|
|
125
126
|
};
|
|
126
127
|
Object.defineProperty(SimpleButtonView.prototype, "selected", {
|
|
127
128
|
get: function () {
|
|
@@ -147,38 +148,6 @@ var SimpleButtonView = /** @class */ (function (_super) {
|
|
|
147
148
|
}
|
|
148
149
|
return result;
|
|
149
150
|
};
|
|
150
|
-
SimpleButtonView.prototype.createBg = function () {
|
|
151
|
-
var _a;
|
|
152
|
-
var result;
|
|
153
|
-
if ((_a = this.config.bgConfig) === null || _a === void 0 ? void 0 : _a.image) {
|
|
154
|
-
result = Sprite.from(this.config.bgConfig.image.imageId);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
result = new Graphics();
|
|
158
|
-
}
|
|
159
|
-
return result;
|
|
160
|
-
};
|
|
161
|
-
SimpleButtonView.prototype.updateBg = function () {
|
|
162
|
-
var _a, _b;
|
|
163
|
-
if ((_a = this.config.bgConfig) === null || _a === void 0 ? void 0 : _a.image) {
|
|
164
|
-
if (this.config.bgConfig.resizeBg) {
|
|
165
|
-
this.bg.width = this.resizeSize.x;
|
|
166
|
-
this.bg.height = this.resizeSize.y;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
else if ((_b = this.config.bgConfig) === null || _b === void 0 ? void 0 : _b.vector) {
|
|
170
|
-
var vectorBg = this.bg;
|
|
171
|
-
vectorBg.clear();
|
|
172
|
-
var bgColor = this.config.bgConfig.vector.bgColor;
|
|
173
|
-
if (this.state === SimpleButtonState.SELECTED_NORMAL || this.state === SimpleButtonState.OVER || this.state === SimpleButtonState.SELECTED_OVER) {
|
|
174
|
-
bgColor = this.config.bgConfig.vector.overBgColor;
|
|
175
|
-
}
|
|
176
|
-
vectorBg.beginFill(bgColor, this.config.bgConfig.vector.bgAlpha);
|
|
177
|
-
vectorBg.lineStyle(this.config.bgConfig.vector.bgBorderWidth, this.config.bgConfig.vector.bgBorderColor, this.config.bgConfig.vector.bgBorderAlpha, 0);
|
|
178
|
-
vectorBg.drawRect(0, 0, this.resizeSize.x, this.resizeSize.y);
|
|
179
|
-
vectorBg.endFill();
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
151
|
return SimpleButtonView;
|
|
183
152
|
}(ResizableContainer));
|
|
184
153
|
export { SimpleButtonView };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleButtonView.js","sourceRoot":"","sources":["../../../../src/display/views/button/SimpleButtonView.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SimpleButtonView.js","sourceRoot":"","sources":["../../../../src/display/views/button/SimpleButtonView.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAY,gBAAgB,EAAU,MAAM,iBAAiB,CAAC;AAGzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGlE;IAAwE,oCAA4B;IAchG,0BAAY,MAA2B;eACnC,kBAAM,MAAM,CAAC;IACjB,CAAC;IAES,uCAAY,GAAtB,UAAuB,MAA2B;QAC9C,iBAAM,YAAY,WAAE,CAAC;QAErB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC;QACpC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEhC,6BAA6B;QAC7B,sCAAsC;QAEtC,IAAI,CAAC,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACjD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,EAAE;QACF,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;QAC9B,IAAI,CAAC,KAAK,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEtC,IAAI,CAAC,KAAK,GAAG,iBAAiB,CAAC,MAAM,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAEpB,yCAAyC;QACzC,mBAAmB;QACnB,yBAAyB;QACzB,yBAAyB;QACzB,SAAS;QACT,IAAI;IACR,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