@wcardinal/wcardinal-ui 0.398.0 → 0.400.0
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.
- package/dist/types/wcardinal/ui/d-base-state-set-impl.d.ts +5 -0
- package/dist/types/wcardinal/ui/d-base-state-set.d.ts +4 -0
- package/dist/types/wcardinal/ui/d-base-state.d.ts +1 -0
- package/dist/types/wcardinal/ui/d-base.d.ts +13 -1
- package/dist/types/wcardinal/ui/d-button-color.d.ts +0 -3
- package/dist/types/wcardinal/ui/d-image-base-theme-wrapper-other.d.ts +19 -0
- package/dist/types/wcardinal/ui/d-image-base-theme-wrapper-secondary.d.ts +3 -1
- package/dist/types/wcardinal/ui/d-image-base-theme-wrapper-tertiary.d.ts +3 -1
- package/dist/types/wcardinal/ui/d-image-base.d.ts +11 -26
- package/dist/types/wcardinal/ui/d-image-piece-align-impl.d.ts +23 -0
- package/dist/types/wcardinal/ui/d-image-piece-align.d.ts +14 -0
- package/dist/types/wcardinal/ui/d-image-piece-container-impl.d.ts +24 -0
- package/dist/types/wcardinal/ui/d-image-piece-container.d.ts +12 -0
- package/dist/types/wcardinal/ui/d-image-piece-impl.d.ts +60 -0
- package/dist/types/wcardinal/ui/d-image-piece-layouter-part-bottom.d.ts +3 -0
- package/dist/types/wcardinal/ui/d-image-piece-layouter-part-center.d.ts +2 -1
- package/dist/types/wcardinal/ui/d-image-piece-layouter-part-left.d.ts +3 -0
- package/dist/types/wcardinal/ui/d-image-piece-layouter-part-middle.d.ts +2 -1
- package/dist/types/wcardinal/ui/d-image-piece-layouter-part-right.d.ts +3 -0
- package/dist/types/wcardinal/ui/d-image-piece-layouter-part-top.d.ts +3 -0
- package/dist/types/wcardinal/ui/d-image-piece-layouter-part.d.ts +4 -2
- package/dist/types/wcardinal/ui/d-image-piece-margin-impl.d.ts +17 -0
- package/dist/types/wcardinal/ui/d-image-piece-margin.d.ts +9 -0
- package/dist/types/wcardinal/ui/d-image-piece-tint-impl.d.ts +23 -0
- package/dist/types/wcardinal/ui/d-image-piece-tint.d.ts +13 -0
- package/dist/types/wcardinal/ui/d-image-piece.d.ts +14 -77
- package/dist/types/wcardinal/ui/d-indicator-processing.d.ts +69 -0
- package/dist/types/wcardinal/ui/index.d.ts +11 -0
- package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-en-us-dialog-processing.d.ts +2 -0
- package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-en-us-indicator-processing.d.ts +5 -0
- package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-image-base.d.ts +3 -0
- package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-indicator-processing.d.ts +13 -0
- package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-ja-jp-dialog-processing.d.ts +2 -0
- package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-ja-jp-indicator-processing.d.ts +5 -0
- package/dist/types/wcardinal/ui/theme/dark/index-en-us.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/dark/index-ja-jp.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/dark/index-zz-zz.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/dark/load/index-en-us.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/dark/load/index-ja-jp.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/dark/load/load-theme-dark-en-us-indicator-processing.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/dark/load/load-theme-dark-ja-jp-indicator-processing.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/white/d-theme-white-en-us-dialog-processing.d.ts +2 -0
- package/dist/types/wcardinal/ui/theme/white/d-theme-white-en-us-indicator-processing.d.ts +5 -0
- package/dist/types/wcardinal/ui/theme/white/d-theme-white-image-base.d.ts +3 -0
- package/dist/types/wcardinal/ui/theme/white/d-theme-white-indicator-processing.d.ts +13 -0
- package/dist/types/wcardinal/ui/theme/white/d-theme-white-ja-jp-dialog-processing.d.ts +2 -0
- package/dist/types/wcardinal/ui/theme/white/d-theme-white-ja-jp-indicator-processing.d.ts +5 -0
- package/dist/types/wcardinal/ui/theme/white/index-en-us.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/white/index-ja-jp.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/white/index-zz-zz.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/white/load/index-en-us.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/white/load/index-ja-jp.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/white/load/load-theme-white-en-us-indicator-processing.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/white/load/load-theme-white-ja-jp-indicator-processing.d.ts +1 -0
- package/dist/wcardinal/ui/d-base-state-set-impl.js +31 -0
- package/dist/wcardinal/ui/d-base-state-set-impl.js.map +1 -1
- package/dist/wcardinal/ui/d-base-state-set.js.map +1 -1
- package/dist/wcardinal/ui/d-base-state.js +1 -0
- package/dist/wcardinal/ui/d-base-state.js.map +1 -1
- package/dist/wcardinal/ui/d-base.js +63 -7
- package/dist/wcardinal/ui/d-base.js.map +1 -1
- package/dist/wcardinal/ui/d-button-color.js +6 -29
- package/dist/wcardinal/ui/d-button-color.js.map +1 -1
- package/dist/wcardinal/ui/d-dialog-processing.js +3 -2
- package/dist/wcardinal/ui/d-dialog-processing.js.map +1 -1
- package/dist/wcardinal/ui/d-image-base-theme-wrapper-other.js +35 -0
- package/dist/wcardinal/ui/d-image-base-theme-wrapper-other.js.map +1 -0
- package/dist/wcardinal/ui/d-image-base-theme-wrapper-secondary.js +5 -1
- package/dist/wcardinal/ui/d-image-base-theme-wrapper-secondary.js.map +1 -1
- package/dist/wcardinal/ui/d-image-base-theme-wrapper-tertiary.js +5 -1
- package/dist/wcardinal/ui/d-image-base-theme-wrapper-tertiary.js.map +1 -1
- package/dist/wcardinal/ui/d-image-base.js +22 -51
- package/dist/wcardinal/ui/d-image-base.js.map +1 -1
- package/dist/wcardinal/ui/d-image-piece-align-impl.js +89 -0
- package/dist/wcardinal/ui/d-image-piece-align-impl.js.map +1 -0
- package/dist/wcardinal/ui/d-image-piece-align.js +2 -0
- package/dist/wcardinal/ui/d-image-piece-align.js.map +1 -0
- package/dist/wcardinal/ui/d-image-piece-container-impl.js +108 -0
- package/dist/wcardinal/ui/d-image-piece-container-impl.js.map +1 -0
- package/dist/wcardinal/ui/d-image-piece-container.js +2 -0
- package/dist/wcardinal/ui/d-image-piece-container.js.map +1 -0
- package/dist/wcardinal/ui/d-image-piece-impl.js +235 -0
- package/dist/wcardinal/ui/d-image-piece-impl.js.map +1 -0
- package/dist/wcardinal/ui/d-image-piece-layouter-part-bottom.js +15 -4
- package/dist/wcardinal/ui/d-image-piece-layouter-part-bottom.js.map +1 -1
- package/dist/wcardinal/ui/d-image-piece-layouter-part-center.js +8 -5
- package/dist/wcardinal/ui/d-image-piece-layouter-part-center.js.map +1 -1
- package/dist/wcardinal/ui/d-image-piece-layouter-part-container.js +13 -17
- package/dist/wcardinal/ui/d-image-piece-layouter-part-container.js.map +1 -1
- package/dist/wcardinal/ui/d-image-piece-layouter-part-left.js +15 -4
- package/dist/wcardinal/ui/d-image-piece-layouter-part-left.js.map +1 -1
- package/dist/wcardinal/ui/d-image-piece-layouter-part-middle.js +8 -5
- package/dist/wcardinal/ui/d-image-piece-layouter-part-middle.js.map +1 -1
- package/dist/wcardinal/ui/d-image-piece-layouter-part-right.js +15 -4
- package/dist/wcardinal/ui/d-image-piece-layouter-part-right.js.map +1 -1
- package/dist/wcardinal/ui/d-image-piece-layouter-part-top.js +15 -4
- package/dist/wcardinal/ui/d-image-piece-layouter-part-top.js.map +1 -1
- package/dist/wcardinal/ui/d-image-piece-layouter-part.js +2 -6
- package/dist/wcardinal/ui/d-image-piece-layouter-part.js.map +1 -1
- package/dist/wcardinal/ui/d-image-piece-layouter.js +2 -2
- package/dist/wcardinal/ui/d-image-piece-layouter.js.map +1 -1
- package/dist/wcardinal/ui/d-image-piece-margin-impl.js +55 -0
- package/dist/wcardinal/ui/d-image-piece-margin-impl.js.map +1 -0
- package/dist/wcardinal/ui/d-image-piece-margin.js +2 -0
- package/dist/wcardinal/ui/d-image-piece-margin.js.map +1 -0
- package/dist/wcardinal/ui/d-image-piece-tint-impl.js +90 -0
- package/dist/wcardinal/ui/d-image-piece-tint-impl.js.map +1 -0
- package/dist/wcardinal/ui/d-image-piece-tint.js +2 -0
- package/dist/wcardinal/ui/d-image-piece-tint.js.map +1 -0
- package/dist/wcardinal/ui/d-image-piece.js +1 -287
- package/dist/wcardinal/ui/d-image-piece.js.map +1 -1
- package/dist/wcardinal/ui/d-indicator-processing.js +216 -0
- package/dist/wcardinal/ui/d-indicator-processing.js.map +1 -0
- package/dist/wcardinal/ui/d-table-header-cell.js +10 -5
- package/dist/wcardinal/ui/d-table-header-cell.js.map +1 -1
- package/dist/wcardinal/ui/d-text-base.js +9 -1
- package/dist/wcardinal/ui/d-text-base.js.map +1 -1
- package/dist/wcardinal/ui/index.js +11 -0
- package/dist/wcardinal/ui/index.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-en-us-dialog-processing.js +2 -2
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-en-us-dialog-processing.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-en-us-indicator-processing.js +19 -0
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-en-us-indicator-processing.js.map +1 -0
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-image-base.js +9 -0
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-image-base.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-indicator-processing.js +74 -0
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-indicator-processing.js.map +1 -0
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-ja-jp-dialog-processing.js +2 -2
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-ja-jp-dialog-processing.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-ja-jp-indicator-processing.js +19 -0
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-ja-jp-indicator-processing.js.map +1 -0
- package/dist/wcardinal/ui/theme/dark/index-en-us.js +1 -0
- package/dist/wcardinal/ui/theme/dark/index-en-us.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/index-ja-jp.js +1 -0
- package/dist/wcardinal/ui/theme/dark/index-ja-jp.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/index-zz-zz.js +1 -0
- package/dist/wcardinal/ui/theme/dark/index-zz-zz.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/load/index-en-us.js +1 -0
- package/dist/wcardinal/ui/theme/dark/load/index-en-us.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/load/index-ja-jp.js +1 -0
- package/dist/wcardinal/ui/theme/dark/load/index-ja-jp.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/load/load-theme-dark-en-us-all.js +2 -0
- package/dist/wcardinal/ui/theme/dark/load/load-theme-dark-en-us-all.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/load/load-theme-dark-en-us-indicator-processing.js +10 -0
- package/dist/wcardinal/ui/theme/dark/load/load-theme-dark-en-us-indicator-processing.js.map +1 -0
- package/dist/wcardinal/ui/theme/dark/load/load-theme-dark-ja-jp-all.js +2 -0
- package/dist/wcardinal/ui/theme/dark/load/load-theme-dark-ja-jp-all.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/load/load-theme-dark-ja-jp-indicator-processing.js +10 -0
- package/dist/wcardinal/ui/theme/dark/load/load-theme-dark-ja-jp-indicator-processing.js.map +1 -0
- package/dist/wcardinal/ui/theme/white/d-theme-white-en-us-dialog-processing.js +2 -2
- package/dist/wcardinal/ui/theme/white/d-theme-white-en-us-dialog-processing.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/d-theme-white-en-us-indicator-processing.js +19 -0
- package/dist/wcardinal/ui/theme/white/d-theme-white-en-us-indicator-processing.js.map +1 -0
- package/dist/wcardinal/ui/theme/white/d-theme-white-image-base.js +9 -0
- package/dist/wcardinal/ui/theme/white/d-theme-white-image-base.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/d-theme-white-indicator-processing.js +74 -0
- package/dist/wcardinal/ui/theme/white/d-theme-white-indicator-processing.js.map +1 -0
- package/dist/wcardinal/ui/theme/white/d-theme-white-ja-jp-dialog-processing.js +2 -2
- package/dist/wcardinal/ui/theme/white/d-theme-white-ja-jp-dialog-processing.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/d-theme-white-ja-jp-indicator-processing.js +19 -0
- package/dist/wcardinal/ui/theme/white/d-theme-white-ja-jp-indicator-processing.js.map +1 -0
- package/dist/wcardinal/ui/theme/white/index-en-us.js +1 -0
- package/dist/wcardinal/ui/theme/white/index-en-us.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/index-ja-jp.js +1 -0
- package/dist/wcardinal/ui/theme/white/index-ja-jp.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/index-zz-zz.js +1 -0
- package/dist/wcardinal/ui/theme/white/index-zz-zz.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/load/index-en-us.js +1 -0
- package/dist/wcardinal/ui/theme/white/load/index-en-us.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/load/index-ja-jp.js +1 -0
- package/dist/wcardinal/ui/theme/white/load/index-ja-jp.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/load/load-theme-white-en-us-all.js +2 -0
- package/dist/wcardinal/ui/theme/white/load/load-theme-white-en-us-all.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/load/load-theme-white-en-us-indicator-processing.js +10 -0
- package/dist/wcardinal/ui/theme/white/load/load-theme-white-en-us-indicator-processing.js.map +1 -0
- package/dist/wcardinal/ui/theme/white/load/load-theme-white-ja-jp-all.js +2 -0
- package/dist/wcardinal/ui/theme/white/load/load-theme-white-ja-jp-all.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/load/load-theme-white-ja-jp-indicator-processing.js +10 -0
- package/dist/wcardinal/ui/theme/white/load/load-theme-white-ja-jp-indicator-processing.js.map +1 -0
- package/dist/wcardinal-ui-theme-dark-en-us.js +112 -3
- package/dist/wcardinal-ui-theme-dark-en-us.min.js +2 -2
- package/dist/wcardinal-ui-theme-dark-en-us.min.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.js +112 -3
- package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +2 -2
- package/dist/wcardinal-ui-theme-dark-ja-jp.min.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark.js +112 -3
- package/dist/wcardinal-ui-theme-dark.min.js +2 -2
- package/dist/wcardinal-ui-theme-white-en-us.js +112 -3
- package/dist/wcardinal-ui-theme-white-en-us.min.js +2 -2
- package/dist/wcardinal-ui-theme-white-en-us.min.js.map +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.js +112 -3
- package/dist/wcardinal-ui-theme-white-ja-jp.min.js +2 -2
- package/dist/wcardinal-ui-theme-white-ja-jp.min.js.map +1 -1
- package/dist/wcardinal-ui-theme-white.js +112 -3
- package/dist/wcardinal-ui-theme-white.min.js +2 -2
- package/dist/wcardinal-ui.cjs.js +1413 -513
- package/dist/wcardinal-ui.js +1127 -495
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { DImageBaseThemeWrapperOther } from "./d-image-base-theme-wrapper-other";
|
|
2
|
+
import { DImageBaseThemeWrapperSecondary } from "./d-image-base-theme-wrapper-secondary";
|
|
3
|
+
import { DImageBaseThemeWrapperTertiary } from "./d-image-base-theme-wrapper-tertiary";
|
|
4
|
+
import { DImagePieceImpl } from "./d-image-piece-impl";
|
|
5
|
+
var DImagePieceContainerImpl = /** @class */ (function () {
|
|
6
|
+
function DImagePieceContainerImpl(parent, theme, options) {
|
|
7
|
+
this._parent = parent;
|
|
8
|
+
this._theme = theme;
|
|
9
|
+
var pieces = [];
|
|
10
|
+
this._pieces = pieces;
|
|
11
|
+
if (options != null) {
|
|
12
|
+
var images = options.images;
|
|
13
|
+
if (images != null) {
|
|
14
|
+
pieces.push(this.newImage(theme, 0 < images.length ? images[0] : undefined));
|
|
15
|
+
if (theme.getSecondaryImageSource != null || 1 < images.length) {
|
|
16
|
+
pieces.push(this.newImage(new DImageBaseThemeWrapperSecondary(theme), images[1]));
|
|
17
|
+
}
|
|
18
|
+
if (theme.getTertiaryImageSource != null || 2 < images.length) {
|
|
19
|
+
pieces.push(this.newImage(new DImageBaseThemeWrapperTertiary(theme), images[2]));
|
|
20
|
+
}
|
|
21
|
+
if (3 < images.length) {
|
|
22
|
+
var other = new DImageBaseThemeWrapperOther(theme);
|
|
23
|
+
for (var i = 3, imax = images.length; i < imax; ++i) {
|
|
24
|
+
pieces.push(this.newImage(other, images[i]));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
pieces.push(this.newImage(theme, options.image));
|
|
30
|
+
if (theme.getSecondaryImageSource != null) {
|
|
31
|
+
pieces.push(this.newImage(new DImageBaseThemeWrapperSecondary(theme)));
|
|
32
|
+
}
|
|
33
|
+
if (theme.getTertiaryImageSource != null) {
|
|
34
|
+
pieces.push(this.newImage(new DImageBaseThemeWrapperTertiary(theme)));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
pieces.push(this.newImage(theme));
|
|
40
|
+
if (theme.getSecondaryImageSource != null) {
|
|
41
|
+
pieces.push(this.newImage(new DImageBaseThemeWrapperSecondary(theme)));
|
|
42
|
+
}
|
|
43
|
+
if (theme.getTertiaryImageSource != null) {
|
|
44
|
+
pieces.push(this.newImage(new DImageBaseThemeWrapperTertiary(theme)));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
DImagePieceContainerImpl.prototype.newImage = function (theme, options) {
|
|
49
|
+
return new DImagePieceImpl(this._parent, theme, options);
|
|
50
|
+
};
|
|
51
|
+
DImagePieceContainerImpl.prototype.onStateChange = function (newState, oldState) {
|
|
52
|
+
var pieces = this._pieces;
|
|
53
|
+
for (var i = 0, imax = pieces.length; i < imax; ++i) {
|
|
54
|
+
pieces[i].onStateChange(newState, oldState);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
DImagePieceContainerImpl.prototype.isRefitable = function (target) {
|
|
58
|
+
var pieces = this._pieces;
|
|
59
|
+
for (var i = 0, imax = pieces.length; i < imax; ++i) {
|
|
60
|
+
if (pieces[i].isRefitable(target)) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
};
|
|
66
|
+
DImagePieceContainerImpl.prototype.updateTextAndImage = function (layouter) {
|
|
67
|
+
var pieces = this._pieces;
|
|
68
|
+
for (var i = 0, imax = pieces.length; i < imax; ++i) {
|
|
69
|
+
var piece = pieces[i];
|
|
70
|
+
piece.updateSource();
|
|
71
|
+
piece.updateTint();
|
|
72
|
+
piece.updateRotation();
|
|
73
|
+
layouter.add(piece);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
DImagePieceContainerImpl.prototype.add = function (options) {
|
|
77
|
+
var result = this.newImage(this._theme, options);
|
|
78
|
+
this._pieces.push(result);
|
|
79
|
+
return result;
|
|
80
|
+
};
|
|
81
|
+
DImagePieceContainerImpl.prototype.get = function (index) {
|
|
82
|
+
var pieces = this._pieces;
|
|
83
|
+
if (0 <= index && index < pieces.length) {
|
|
84
|
+
return pieces[index];
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
};
|
|
88
|
+
DImagePieceContainerImpl.prototype.remove = function (index) {
|
|
89
|
+
var pieces = this._pieces;
|
|
90
|
+
if (0 <= index && index < pieces.length) {
|
|
91
|
+
pieces[index].destroy();
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
};
|
|
96
|
+
DImagePieceContainerImpl.prototype.size = function () {
|
|
97
|
+
return this._pieces.length;
|
|
98
|
+
};
|
|
99
|
+
DImagePieceContainerImpl.prototype.destroy = function () {
|
|
100
|
+
var pieces = this._pieces;
|
|
101
|
+
for (var i = 0, imax = pieces.length; i < imax; ++i) {
|
|
102
|
+
pieces[i].destroy();
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return DImagePieceContainerImpl;
|
|
106
|
+
}());
|
|
107
|
+
export { DImagePieceContainerImpl };
|
|
108
|
+
//# sourceMappingURL=d-image-piece-container-impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"d-image-piece-container-impl.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-image-piece-container-impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AAGvF,OAAO,EAAE,eAAe,EAAyB,MAAM,sBAAsB,CAAC;AAQ9E;IAKC,kCACC,MAA6B,EAC7B,KAAgC,EAChC,OAAyC;QAEzC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAM,MAAM,GAAsB,EAAE,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,IAAI,OAAO,IAAI,IAAI,EAAE;YACpB,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC9B,IAAI,MAAM,IAAI,IAAI,EAAE;gBACnB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;gBAC7E,IAAI,KAAK,CAAC,uBAAuB,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AC5B,CAAC;IAED,0CAAO,GAAP;QACC,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;YACpD,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACpB;IACF,CAAC;IACF,+BAAC;AAAD,CAAC,AAxHD,IAwHC","sourcesContent":["import { DBaseStateSet } from \"./d-base-state-set\";\nimport { DImageBaseThemeWrapperOther } from \"./d-image-base-theme-wrapper-other\";\nimport { DImageBaseThemeWrapperSecondary } from \"./d-image-base-theme-wrapper-secondary\";\nimport { DImageBaseThemeWrapperTertiary } from \"./d-image-base-theme-wrapper-tertiary\";\nimport { DImagePiece, DImagePieceOptions, DThemeImagePiece } from \"./d-image-piece\";\nimport { DImagePieceContainer, DThemeImagePieceContainer } from \"./d-image-piece-container\";\nimport { DImagePieceImpl, DImagePieceImplParent } from \"./d-image-piece-impl\";\nimport { DImagePieceLayouter } from \"./d-image-piece-layouter\";\n\nexport interface DImagePieceContainerImplOptions {\n\timage?: DImagePieceOptions;\n\timages?: DImagePieceOptions[];\n}\n\nexport class DImagePieceContainerImpl implements DImagePieceContainer {\n\tprotected _parent: DImagePieceImplParent;\n\tprotected _theme: DThemeImagePieceContainer;\n\tprotected _pieces: DImagePieceImpl[];\n\n\tconstructor(\n\t\tparent: DImagePieceImplParent,\n\t\ttheme: DThemeImagePieceContainer,\n\t\toptions?: DImagePieceContainerImplOptions\n\t) {\n\t\tthis._parent = parent;\n\t\tthis._theme = theme;\n\t\tconst pieces: DImagePieceImpl[] = [];\n\t\tthis._pieces = pieces;\n\n\t\tif (options != null) {\n\t\t\tconst images = options.images;\n\t\t\tif (images != null) {\n\t\t\t\tpieces.push(this.newImage(theme, 0 < images.length ? images[0] : undefined));\n\t\t\t\tif (theme.getSecondaryImageSource != null || 1 < images.length) {\n\t\t\t\t\tpieces.push(\n\t\t\t\t\t\tthis.newImage(new DImageBaseThemeWrapperSecondary(theme), images[1])\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (theme.getTertiaryImageSource != null || 2 < images.length) {\n\t\t\t\t\tpieces.push(\n\t\t\t\t\t\tthis.newImage(new DImageBaseThemeWrapperTertiary(theme), images[2])\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (3 < images.length) {\n\t\t\t\t\tconst other = new DImageBaseThemeWrapperOther(theme);\n\t\t\t\t\tfor (let i = 3, imax = images.length; i < imax; ++i) {\n\t\t\t\t\t\tpieces.push(this.newImage(other, images[i]));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpieces.push(this.newImage(theme, options.image));\n\t\t\t\tif (theme.getSecondaryImageSource != null) {\n\t\t\t\t\tpieces.push(this.newImage(new DImageBaseThemeWrapperSecondary(theme)));\n\t\t\t\t}\n\t\t\t\tif (theme.getTertiaryImageSource != null) {\n\t\t\t\t\tpieces.push(this.newImage(new DImageBaseThemeWrapperTertiary(theme)));\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tpieces.push(this.newImage(theme));\n\t\t\tif (theme.getSecondaryImageSource != null) {\n\t\t\t\tpieces.push(this.newImage(new DImageBaseThemeWrapperSecondary(theme)));\n\t\t\t}\n\t\t\tif (theme.getTertiaryImageSource != null) {\n\t\t\t\tpieces.push(this.newImage(new DImageBaseThemeWrapperTertiary(theme)));\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected newImage(theme: DThemeImagePiece, options?: DImagePieceOptions): DImagePieceImpl {\n\t\treturn new DImagePieceImpl(this._parent, theme, options);\n\t}\n\n\tonStateChange(newState: DBaseStateSet, oldState: DBaseStateSet): void {\n\t\tconst pieces = this._pieces;\n\t\tfor (let i = 0, imax = pieces.length; i < imax; ++i) {\n\t\t\tpieces[i].onStateChange(newState, oldState);\n\t\t}\n\t}\n\n\tisRefitable(target: any): boolean {\n\t\tconst pieces = this._pieces;\n\t\tfor (let i = 0, imax = pieces.length; i < imax; ++i) {\n\t\t\tif (pieces[i].isRefitable(target)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tupdateTextAndImage(layouter: DImagePieceLayouter): void {\n\t\tconst pieces = this._pieces;\n\t\tfor (let i = 0, imax = pieces.length; i < imax; ++i) {\n\t\t\tconst piece = pieces[i];\n\t\t\tpiece.updateSource();\n\t\t\tpiece.updateTint();\n\t\t\tpiece.updateRotation();\n\t\t\tlayouter.add(piece);\n\t\t}\n\t}\n\n\tadd(options?: DImagePieceOptions): DImagePiece {\n\t\tconst result = this.newImage(this._theme, options);\n\t\tthis._pieces.push(result);\n\t\treturn result;\n\t}\n\n\tget(index: number): DImagePiece | null {\n\t\tconst pieces = this._pieces;\n\t\tif (0 <= index && index < pieces.length) {\n\t\t\treturn pieces[index];\n\t\t}\n\t\treturn null;\n\t}\n\n\tremove(index: number): boolean {\n\t\tconst pieces = this._pieces;\n\t\tif (0 <= index && index < pieces.length) {\n\t\t\tpieces[index].destroy();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tsize(): number {\n\t\treturn this._pieces.length;\n\t}\n\n\tdestroy(): void {\n\t\tconst pieces = this._pieces;\n\t\tfor (let i = 0, imax = pieces.length; i < imax; ++i) {\n\t\t\tpieces[i].destroy();\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"d-image-piece-container.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-image-piece-container.ts"],"names":[],"mappings":"","sourcesContent":["import { DThemeImageBaseSecondary } from \"./d-image-base-theme-wrapper-secondary\";\nimport { DThemeImageBaseTertiary } from \"./d-image-base-theme-wrapper-tertiary\";\nimport { DImagePiece, DImagePieceOptions, DThemeImagePiece } from \"./d-image-piece\";\n\nexport interface DThemeImagePieceContainer\n\textends DThemeImagePiece,\n\t\tDThemeImageBaseSecondary,\n\t\tDThemeImageBaseTertiary {}\n\nexport interface DImagePieceContainer {\n\tadd(options?: DImagePieceOptions): DImagePiece;\n\tget(index: number): DImagePiece | null;\n\tremove(index: number): boolean;\n\tsize(): number;\n\tdestroy(): void;\n}\n"]}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { Sprite, Texture } from "pixi.js";
|
|
2
|
+
import { DApplications } from "./d-applications";
|
|
3
|
+
import { isFunction } from "./util/is-function";
|
|
4
|
+
import { DImagePieceTintImpl } from "./d-image-piece-tint-impl";
|
|
5
|
+
import { DImagePieceMarginImpl } from "./d-image-piece-margin-impl";
|
|
6
|
+
import { DImagePieceAlignImpl } from "./d-image-piece-align-impl";
|
|
7
|
+
var DImagePieceImpl = /** @class */ (function () {
|
|
8
|
+
function DImagePieceImpl(parent, theme, options) {
|
|
9
|
+
var _this = this;
|
|
10
|
+
this._parent = parent;
|
|
11
|
+
this._theme = theme;
|
|
12
|
+
this._object = null;
|
|
13
|
+
this._align = new DImagePieceAlignImpl(this, theme, options === null || options === void 0 ? void 0 : options.align);
|
|
14
|
+
this._margin = new DImagePieceMarginImpl(this, theme, options === null || options === void 0 ? void 0 : options.margin);
|
|
15
|
+
this._tint = new DImagePieceTintImpl(this, theme, options === null || options === void 0 ? void 0 : options.tint);
|
|
16
|
+
this._rotation = options === null || options === void 0 ? void 0 : options.rotation;
|
|
17
|
+
this._source = options === null || options === void 0 ? void 0 : options.source;
|
|
18
|
+
this._computed = null;
|
|
19
|
+
this._onUpdateBound = function () {
|
|
20
|
+
_this.onUpdate();
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(DImagePieceImpl.prototype, "object", {
|
|
24
|
+
get: function () {
|
|
25
|
+
return this._object;
|
|
26
|
+
},
|
|
27
|
+
enumerable: false,
|
|
28
|
+
configurable: true
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(DImagePieceImpl.prototype, "align", {
|
|
31
|
+
get: function () {
|
|
32
|
+
return this._align;
|
|
33
|
+
},
|
|
34
|
+
enumerable: false,
|
|
35
|
+
configurable: true
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(DImagePieceImpl.prototype, "margin", {
|
|
38
|
+
get: function () {
|
|
39
|
+
return this._margin;
|
|
40
|
+
},
|
|
41
|
+
enumerable: false,
|
|
42
|
+
configurable: true
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(DImagePieceImpl.prototype, "tint", {
|
|
45
|
+
get: function () {
|
|
46
|
+
return this._tint;
|
|
47
|
+
},
|
|
48
|
+
enumerable: false,
|
|
49
|
+
configurable: true
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(DImagePieceImpl.prototype, "source", {
|
|
52
|
+
get: function () {
|
|
53
|
+
return this._source;
|
|
54
|
+
},
|
|
55
|
+
set: function (source) {
|
|
56
|
+
if (this._source !== source) {
|
|
57
|
+
this._source = source;
|
|
58
|
+
if (this.updateSource()) {
|
|
59
|
+
this.onUpdate();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
enumerable: false,
|
|
64
|
+
configurable: true
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(DImagePieceImpl.prototype, "rotation", {
|
|
67
|
+
get: function () {
|
|
68
|
+
return this._rotation;
|
|
69
|
+
},
|
|
70
|
+
set: function (rotation) {
|
|
71
|
+
if (this._rotation !== rotation) {
|
|
72
|
+
this._rotation = rotation;
|
|
73
|
+
if (this.updateRotation()) {
|
|
74
|
+
DApplications.update(this._parent);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
enumerable: false,
|
|
79
|
+
configurable: true
|
|
80
|
+
});
|
|
81
|
+
DImagePieceImpl.prototype.computeSource = function () {
|
|
82
|
+
var source = this._source;
|
|
83
|
+
if (source !== undefined) {
|
|
84
|
+
if (isFunction(source)) {
|
|
85
|
+
var result = source(this._parent.state);
|
|
86
|
+
if (result !== undefined) {
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return source;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return this._theme.getImageSource(this._parent.state);
|
|
95
|
+
};
|
|
96
|
+
DImagePieceImpl.prototype.onStateChange = function (newState, oldState) {
|
|
97
|
+
this.updateTint();
|
|
98
|
+
this.updateRotation();
|
|
99
|
+
};
|
|
100
|
+
DImagePieceImpl.prototype.isTintAware = function (target) {
|
|
101
|
+
return target != null && "tint" in target;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Updates the tint.
|
|
105
|
+
*
|
|
106
|
+
* @returns True if the tint is changed.
|
|
107
|
+
*/
|
|
108
|
+
DImagePieceImpl.prototype.updateTint = function () {
|
|
109
|
+
var object = this._object;
|
|
110
|
+
if (object) {
|
|
111
|
+
if (this.isTintAware(object)) {
|
|
112
|
+
var state = this._parent.state;
|
|
113
|
+
var color = this._tint.getColor(state);
|
|
114
|
+
if (color != null) {
|
|
115
|
+
var result = false;
|
|
116
|
+
if (object.tint !== color) {
|
|
117
|
+
object.tint = color;
|
|
118
|
+
result = true;
|
|
119
|
+
}
|
|
120
|
+
var alpha = this._tint.getAlpha(state);
|
|
121
|
+
if (object.alpha !== alpha) {
|
|
122
|
+
object.alpha = alpha;
|
|
123
|
+
result = true;
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
};
|
|
131
|
+
DImagePieceImpl.prototype.toRotation = function (theme, state) {
|
|
132
|
+
var rotation = this._rotation;
|
|
133
|
+
if (rotation != null) {
|
|
134
|
+
if (isFunction(rotation)) {
|
|
135
|
+
var result = rotation(state);
|
|
136
|
+
if (result !== undefined) {
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
return rotation;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return theme.getImageRotation(state);
|
|
145
|
+
};
|
|
146
|
+
DImagePieceImpl.prototype.updateRotation = function () {
|
|
147
|
+
var object = this._object;
|
|
148
|
+
if (object) {
|
|
149
|
+
var theme = this._theme;
|
|
150
|
+
var state = this._parent.state;
|
|
151
|
+
var rotation = this.toRotation(theme, state);
|
|
152
|
+
if (rotation != null) {
|
|
153
|
+
var transform = object.transform;
|
|
154
|
+
if (transform.rotation !== rotation) {
|
|
155
|
+
transform.rotation = rotation;
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return false;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Updates the computed source.
|
|
164
|
+
*
|
|
165
|
+
* @returns True if the computed source is changed
|
|
166
|
+
*/
|
|
167
|
+
DImagePieceImpl.prototype.updateSource = function () {
|
|
168
|
+
var newComputed = this.computeSource();
|
|
169
|
+
var oldComputed = this._computed;
|
|
170
|
+
if (newComputed !== oldComputed) {
|
|
171
|
+
this._computed = newComputed;
|
|
172
|
+
var parent_1 = this._parent;
|
|
173
|
+
var oldObject = this._object;
|
|
174
|
+
var onUpdateBound = this._onUpdateBound;
|
|
175
|
+
if (newComputed instanceof Texture) {
|
|
176
|
+
if (oldComputed instanceof Texture) {
|
|
177
|
+
oldComputed.off("update", onUpdateBound);
|
|
178
|
+
if (oldObject instanceof Sprite) {
|
|
179
|
+
oldObject.texture = newComputed;
|
|
180
|
+
newComputed.on("update", onUpdateBound);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
if (oldObject != null) {
|
|
185
|
+
parent_1.removeChild(oldObject);
|
|
186
|
+
}
|
|
187
|
+
var newObject = new Sprite(newComputed);
|
|
188
|
+
newObject.anchor.set(0.5, 0.5);
|
|
189
|
+
var overflowMask = parent_1.getOverflowMask();
|
|
190
|
+
if (overflowMask) {
|
|
191
|
+
newObject.mask = overflowMask;
|
|
192
|
+
}
|
|
193
|
+
newComputed.on("update", onUpdateBound);
|
|
194
|
+
parent_1.addChild(newObject);
|
|
195
|
+
this._object = newObject;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
if (oldComputed instanceof Texture) {
|
|
200
|
+
oldComputed.off("update", onUpdateBound);
|
|
201
|
+
if (oldObject != null) {
|
|
202
|
+
parent_1.removeChild(oldObject);
|
|
203
|
+
oldObject.destroy();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else if (oldObject != null) {
|
|
207
|
+
parent_1.removeChild(oldObject);
|
|
208
|
+
}
|
|
209
|
+
if (newComputed != null) {
|
|
210
|
+
var overflowMask = parent_1.getOverflowMask();
|
|
211
|
+
if (overflowMask) {
|
|
212
|
+
newComputed.mask = overflowMask;
|
|
213
|
+
}
|
|
214
|
+
parent_1.addChild(newComputed);
|
|
215
|
+
}
|
|
216
|
+
this._object = newComputed;
|
|
217
|
+
}
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
return false;
|
|
221
|
+
};
|
|
222
|
+
DImagePieceImpl.prototype.isRefitable = function (target) {
|
|
223
|
+
return target != null && target === this._object;
|
|
224
|
+
};
|
|
225
|
+
DImagePieceImpl.prototype.destroy = function () {
|
|
226
|
+
this.source = null;
|
|
227
|
+
};
|
|
228
|
+
DImagePieceImpl.prototype.onUpdate = function () {
|
|
229
|
+
this._parent.toDirty();
|
|
230
|
+
DApplications.update(this._parent);
|
|
231
|
+
};
|
|
232
|
+
return DImagePieceImpl;
|
|
233
|
+
}());
|
|
234
|
+
export { DImagePieceImpl };
|
|
235
|
+
//# sourceMappingURL=d-image-piece-impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"d-image-piece-impl.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-image-piece-impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,E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BACjB,WAAW,CAAC,IAAI,GAAG,YAAY,CAAC;qBAChC;oBACD,QAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;iBAC7B;gBACD,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC;aAC3B;YACD,OAAO,IAAI,CAAC;SACZ;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAED,qCAAW,GAAX,UAAY,MAAW;QACtB,OAAO,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,IAAI,CAAC,OAAO,CAAC;IAClD,CAAC;IAED,iCAAO,GAAP;QACC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,kCAAQ,GAAR;QACC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACvB,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IACF,sBAAC;AAAD,CAAC,AA7OD,IA6OC","sourcesContent":["import { DisplayObject, Graphics, Sprite, Texture } from \"pixi.js\";\nimport { DApplicationTarget } from \"./d-application-like\";\nimport { DApplications } from \"./d-applications\";\nimport { DBaseStateSet } from \"./d-base-state-set\";\nimport { DStateAwareOrValueMightBe } from \"./d-state-aware\";\nimport { isFunction } from \"./util/is-function\";\nimport { DImagePieceTint } from \"./d-image-piece-tint\";\nimport { DImagePieceTintImpl } from \"./d-image-piece-tint-impl\";\nimport { DImagePieceMarginImpl } from \"./d-image-piece-margin-impl\";\nimport { DImagePieceMargin } from \"./d-image-piece-margin\";\nimport { DImagePieceAlign } from \"./d-image-piece-align\";\nimport { DImagePieceAlignImpl } from \"./d-image-piece-align-impl\";\nimport { DImagePiece, DImagePieceOptions, DThemeImagePiece } from \"./d-image-piece\";\n\nexport interface DImagePieceImplParent extends DApplicationTarget {\n\treadonly state: DBaseStateSet;\n\taddChild(displayObject: DisplayObject): void;\n\tremoveChild(displayObject: DisplayObject): void;\n\ttoDirty(): void;\n\tgetOverflowMask(): Graphics | null;\n}\n\nexport class DImagePieceImpl implements DImagePiece {\n\tprotected _parent: DImagePieceImplParent;\n\tprotected _theme: DThemeImagePiece;\n\n\tprotected _object: DisplayObject | null;\n\tprotected _computed: Texture | DisplayObject | null;\n\tprotected _source: DStateAwareOrValueMightBe<Texture | DisplayObject | null>;\n\tprotected _align: DImagePieceAlignImpl;\n\tprotected _margin: DImagePieceMarginImpl;\n\tprotected _tint: DImagePieceTint;\n\tprotected _rotation: DStateAwareOrValueMightBe<number> | undefined;\n\n\tprotected _onUpdateBound: () => void;\n\n\tconstructor(\n\t\tparent: DImagePieceImplParent,\n\t\ttheme: DThemeImagePiece,\n\t\toptions?: DImagePieceOptions\n\t) {\n\t\tthis._parent = parent;\n\t\tthis._theme = theme;\n\n\t\tthis._object = null;\n\t\tthis._align = new DImagePieceAlignImpl(this, theme, options?.align);\n\t\tthis._margin = new DImagePieceMarginImpl(this, theme, options?.margin);\n\t\tthis._tint = new DImagePieceTintImpl(this, theme, options?.tint);\n\t\tthis._rotation = options?.rotation;\n\t\tthis._source = options?.source;\n\t\tthis._computed = null;\n\n\t\tthis._onUpdateBound = () => {\n\t\t\tthis.onUpdate();\n\t\t};\n\t}\n\n\tget object(): DisplayObject | null {\n\t\treturn this._object;\n\t}\n\n\tget align(): DImagePieceAlign {\n\t\treturn this._align;\n\t}\n\n\tget margin(): DImagePieceMargin {\n\t\treturn this._margin;\n\t}\n\n\tget tint(): DImagePieceTint {\n\t\treturn this._tint;\n\t}\n\n\tget source(): DStateAwareOrValueMightBe<Texture | DisplayObject | null> {\n\t\treturn this._source;\n\t}\n\n\tset source(source: DStateAwareOrValueMightBe<Texture | DisplayObject | null>) {\n\t\tif (this._source !== source) {\n\t\t\tthis._source = source;\n\t\t\tif (this.updateSource()) {\n\t\t\t\tthis.onUpdate();\n\t\t\t}\n\t\t}\n\t}\n\n\tget rotation(): DStateAwareOrValueMightBe<number> {\n\t\treturn this._rotation;\n\t}\n\n\tset rotation(rotation: DStateAwareOrValueMightBe<number>) {\n\t\tif (this._rotation !== rotation) {\n\t\t\tthis._rotation = rotation;\n\t\t\tif (this.updateRotation()) {\n\t\t\t\tDApplications.update(this._parent);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected computeSource(): Texture | DisplayObject | null {\n\t\tconst source = this._source;\n\t\tif (source !== undefined) {\n\t\t\tif (isFunction(source)) {\n\t\t\t\tconst result = source(this._parent.state);\n\t\t\t\tif (result !== undefined) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn source;\n\t\t\t}\n\t\t}\n\t\treturn this._theme.getImageSource(this._parent.state);\n\t}\n\n\tonStateChange(newState: DBaseStateSet, oldState: DBaseStateSet): void {\n\t\tthis.updateTint();\n\t\tthis.updateRotation();\n\t}\n\n\tprotected isTintAware(\n\t\ttarget: DisplayObject | null\n\t): target is DisplayObject & { tint: number } {\n\t\treturn target != null && \"tint\" in target;\n\t}\n\n\t/**\n\t * Updates the tint.\n\t *\n\t * @returns True if the tint is changed.\n\t */\n\tupdateTint(): boolean {\n\t\tconst object = this._object;\n\t\tif (object) {\n\t\t\tif (this.isTintAware(object)) {\n\t\t\t\tconst state = this._parent.state;\n\t\t\t\tconst color = this._tint.getColor(state);\n\t\t\t\tif (color != null) {\n\t\t\t\t\tlet result = false;\n\t\t\t\t\tif (object.tint !== color) {\n\t\t\t\t\t\tobject.tint = color;\n\t\t\t\t\t\tresult = true;\n\t\t\t\t\t}\n\t\t\t\t\tconst alpha = this._tint.getAlpha(state);\n\t\t\t\t\tif (object.alpha !== alpha) {\n\t\t\t\t\t\tobject.alpha = alpha;\n\t\t\t\t\t\tresult = true;\n\t\t\t\t\t}\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tprotected toRotation(theme: DThemeImagePiece, state: DBaseStateSet): number | null {\n\t\tconst rotation = this._rotation;\n\t\tif (rotation != null) {\n\t\t\tif (isFunction(rotation)) {\n\t\t\t\tconst result = rotation(state);\n\t\t\t\tif (result !== undefined) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn rotation;\n\t\t\t}\n\t\t}\n\t\treturn theme.getImageRotation(state);\n\t}\n\n\tupdateRotation(): boolean {\n\t\tconst object = this._object;\n\t\tif (object) {\n\t\t\tconst theme = this._theme;\n\t\t\tconst state = this._parent.state;\n\t\t\tconst rotation = this.toRotation(theme, state);\n\t\t\tif (rotation != null) {\n\t\t\t\tconst transform = object.transform;\n\t\t\t\tif (transform.rotation !== rotation) {\n\t\t\t\t\ttransform.rotation = rotation;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Updates the computed source.\n\t *\n\t * @returns True if the computed source is changed\n\t */\n\tupdateSource(): boolean {\n\t\tconst newComputed = this.computeSource();\n\t\tconst oldComputed = this._computed;\n\t\tif (newComputed !== oldComputed) {\n\t\t\tthis._computed = newComputed;\n\n\t\t\tconst parent = this._parent;\n\t\t\tconst oldObject = this._object;\n\t\t\tconst onUpdateBound = this._onUpdateBound;\n\t\t\tif (newComputed instanceof Texture) {\n\t\t\t\tif (oldComputed instanceof Texture) {\n\t\t\t\t\toldComputed.off(\"update\", onUpdateBound);\n\t\t\t\t\tif (oldObject instanceof Sprite) {\n\t\t\t\t\t\toldObject.texture = newComputed;\n\t\t\t\t\t\tnewComputed.on(\"update\", onUpdateBound);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (oldObject != null) {\n\t\t\t\t\t\tparent.removeChild(oldObject);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst newObject = new Sprite(newComputed);\n\t\t\t\t\tnewObject.anchor.set(0.5, 0.5);\n\t\t\t\t\tconst overflowMask = parent.getOverflowMask();\n\t\t\t\t\tif (overflowMask) {\n\t\t\t\t\t\tnewObject.mask = overflowMask;\n\t\t\t\t\t}\n\t\t\t\t\tnewComputed.on(\"update\", onUpdateBound);\n\t\t\t\t\tparent.addChild(newObject);\n\t\t\t\t\tthis._object = newObject;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (oldComputed instanceof Texture) {\n\t\t\t\t\toldComputed.off(\"update\", onUpdateBound);\n\t\t\t\t\tif (oldObject != null) {\n\t\t\t\t\t\tparent.removeChild(oldObject);\n\t\t\t\t\t\toldObject.destroy();\n\t\t\t\t\t}\n\t\t\t\t} else if (oldObject != null) {\n\t\t\t\t\tparent.removeChild(oldObject);\n\t\t\t\t}\n\n\t\t\t\tif (newComputed != null) {\n\t\t\t\t\tconst overflowMask = parent.getOverflowMask();\n\t\t\t\t\tif (overflowMask) {\n\t\t\t\t\t\tnewComputed.mask = overflowMask;\n\t\t\t\t\t}\n\t\t\t\t\tparent.addChild(newComputed);\n\t\t\t\t}\n\t\t\t\tthis._object = newComputed;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tisRefitable(target: any): boolean {\n\t\treturn target != null && target === this._object;\n\t}\n\n\tdestroy(): void {\n\t\tthis.source = null;\n\t}\n\n\tonUpdate(): void {\n\t\tthis._parent.toDirty();\n\t\tDApplications.update(this._parent);\n\t}\n}\n"]}
|
|
@@ -5,23 +5,34 @@ var DImagePieceLayouterPartBottom = /** @class */ (function (_super) {
|
|
|
5
5
|
function DImagePieceLayouterPartBottom() {
|
|
6
6
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
7
7
|
}
|
|
8
|
+
DImagePieceLayouterPartBottom.prototype.add = function (image, bound, margin) {
|
|
9
|
+
this._pieces.push(image);
|
|
10
|
+
this._bounds.push(bound);
|
|
11
|
+
this._size += margin + bound.height;
|
|
12
|
+
this._margin = margin;
|
|
13
|
+
};
|
|
8
14
|
DImagePieceLayouterPartBottom.prototype.execute = function (pbottom, height) {
|
|
9
15
|
var pieces = this._pieces;
|
|
16
|
+
var bounds = this._bounds;
|
|
10
17
|
var y = height - pbottom;
|
|
11
18
|
if (this._text !== undefined) {
|
|
12
19
|
var margin = 0;
|
|
13
20
|
for (var i = 0, imax = pieces.length; i < imax; ++i) {
|
|
14
21
|
var piece = pieces[i];
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
var bound = bounds[i];
|
|
23
|
+
var object = piece.object;
|
|
24
|
+
y -= margin + bound.height;
|
|
25
|
+
object.y = y - bound.y;
|
|
17
26
|
margin = piece.margin.horizontal;
|
|
18
27
|
}
|
|
19
28
|
}
|
|
20
29
|
else {
|
|
21
30
|
for (var i = 0, imax = pieces.length; i < imax; ++i) {
|
|
22
31
|
var piece = pieces[i];
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
var bound = bounds[i];
|
|
33
|
+
var object = piece.object;
|
|
34
|
+
y -= piece.margin.horizontal + bound.height;
|
|
35
|
+
object.y = y - bound.y;
|
|
25
36
|
}
|
|
26
37
|
}
|
|
27
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-image-piece-layouter-part-bottom.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-image-piece-layouter-part-bottom.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"d-image-piece-layouter-part-bottom.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-image-piece-layouter-part-bottom.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAGxE;IAAmD,iDAAuB;IAA1E;;IAgCA,CAAC;IA/BS,2CAAG,GAAZ,UAAa,KAAkB,EAAE,KAAgB,EAAE,MAAc;QAChE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,+CAAO,GAAP,UAAQ,OAAe,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ent":["import { Rectangle } from \"pixi.js\";\nimport { DImagePieceLayouterPart } from \"./d-image-piece-layouter-part\";\nimport { DImagePiece } from \"./d-image-piece\";\n\nexport class DImagePieceLayouterPartBottom extends DImagePieceLayouterPart {\n\toverride add(image: DImagePiece, bound: Rectangle, margin: number): void {\n\t\tthis._pieces.push(image);\n\t\tthis._bounds.push(bound);\n\t\tthis._size += margin + bound.height;\n\t\tthis._margin = margin;\n\t}\n\n\texecute(pbottom: number, height: number): void {\n\t\tconst pieces = this._pieces;\n\t\tconst bounds = this._bounds;\n\t\tlet y = height - pbottom;\n\t\tif (this._text !== undefined) {\n\t\t\tlet margin = 0;\n\t\t\tfor (let i = 0, imax = pieces.length; i < imax; ++i) {\n\t\t\t\tconst piece = pieces[i];\n\t\t\t\tconst bound = bounds[i];\n\t\t\t\tconst object = piece.object!;\n\t\t\t\ty -= margin + bound.height;\n\t\t\t\tobject.y = y - bound.y;\n\t\t\t\tmargin = piece.margin.horizontal;\n\t\t\t}\n\t\t} else {\n\t\t\tfor (let i = 0, imax = pieces.length; i < imax; ++i) {\n\t\t\t\tconst piece = pieces[i];\n\t\t\t\tconst bound = bounds[i];\n\t\t\t\tconst object = piece.object!;\n\t\t\t\ty -= piece.margin.horizontal + bound.height;\n\t\t\t\tobject.y = y - bound.y;\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -5,17 +5,20 @@ var DImagePieceLayouterPartCenter = /** @class */ (function (_super) {
|
|
|
5
5
|
function DImagePieceLayouterPartCenter() {
|
|
6
6
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
7
7
|
}
|
|
8
|
-
DImagePieceLayouterPartCenter.prototype.add = function (image,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this._size = Math.max(this.size,
|
|
8
|
+
DImagePieceLayouterPartCenter.prototype.add = function (image, bound, margin) {
|
|
9
|
+
this._pieces.push(image);
|
|
10
|
+
this._bounds.push(bound);
|
|
11
|
+
this._size = Math.max(this.size, bound.width);
|
|
12
12
|
};
|
|
13
13
|
DImagePieceLayouterPartCenter.prototype.execute = function (pleft, pright, width) {
|
|
14
14
|
var c = pleft + (width - pleft - pright) * 0.5;
|
|
15
15
|
var pieces = this._pieces;
|
|
16
|
+
var bounds = this._bounds;
|
|
16
17
|
for (var i = 0, imax = pieces.length; i < imax; ++i) {
|
|
17
18
|
var piece = pieces[i];
|
|
18
|
-
|
|
19
|
+
var bound = bounds[i];
|
|
20
|
+
var object = piece.object;
|
|
21
|
+
object.x = c - bound.x - bound.width * 0.5;
|
|
19
22
|
}
|
|
20
23
|
};
|
|
21
24
|
return DImagePieceLayouterPartCenter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-image-piece-layouter-part-center.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-image-piece-layouter-part-center.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"d-image-piece-layouter-part-center.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-image-piece-layouter-part-center.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE;IAAmD,iDAAuB;IAA1E;;IAkBA,CAAC;IAjBS,2CAAG,GAAZ,UAAa,KAAkB,EAAE,KAAgB,EAAE,MAAc;QAChE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED,+CAAO,GAAP,UAAQ,KAAa,EAAE,MAAc,EAAE,KAAa;QACnD,IAAM,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC;QACjD,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;YACpD,IAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACxB,IAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACxB,IAAM,MAAM,GAAG,KAAK,CAAC,MAAO,CAAC;YAC7B,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC;SAC3C;IACF,CAAC;IACF,oCAAC;AAAD,CAAC,AAlBD,CAAmD,uBAAuB,GAkBzE","sourcesContent":["import { Rectangle } from \"pixi.js\";\nimport { DImagePiece } from \"./d-image-piece\";\nimport { DImagePieceLayouterPart } from \"./d-image-piece-layouter-part\";\n\nexport class DImagePieceLayouterPartCenter extends DImagePieceLayouterPart {\n\toverride add(image: DImagePiece, bound: Rectangle, margin: number): void {\n\t\tthis._pieces.push(image);\n\t\tthis._bounds.push(bound);\n\t\tthis._size = Math.max(this.size, bound.width);\n\t}\n\n\texecute(pleft: number, pright: number, width: number): void {\n\t\tconst c = pleft + (width - pleft - pright) * 0.5;\n\t\tconst pieces = this._pieces;\n\t\tconst bounds = this._bounds;\n\t\tfor (let i = 0, imax = pieces.length; i < imax; ++i) {\n\t\t\tconst piece = pieces[i];\n\t\t\tconst bound = bounds[i];\n\t\t\tconst object = piece.object!;\n\t\t\tobject.x = c - bound.x - bound.width * 0.5;\n\t\t}\n\t}\n}\n"]}
|
|
@@ -25,35 +25,31 @@ var DImagePieceLayouterPartContainer = /** @class */ (function () {
|
|
|
25
25
|
this.text = undefined;
|
|
26
26
|
};
|
|
27
27
|
DImagePieceLayouterPartContainer.prototype.add = function (image) {
|
|
28
|
-
var
|
|
29
|
-
if (
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
var imageMarginHorizontal = imageMargin.horizontal;
|
|
35
|
-
var imageMarginVertical = imageMargin.vertical;
|
|
36
|
-
var imageAlign = image.align;
|
|
37
|
-
switch (imageAlign.horizontal) {
|
|
28
|
+
var object = image.object;
|
|
29
|
+
if (object != null) {
|
|
30
|
+
var bound = object.getLocalBounds();
|
|
31
|
+
var margin = image.margin;
|
|
32
|
+
var align = image.align;
|
|
33
|
+
switch (align.horizontal) {
|
|
38
34
|
case DAlignHorizontal.LEFT:
|
|
39
|
-
this.left.add(image,
|
|
35
|
+
this.left.add(image, bound, margin.horizontal);
|
|
40
36
|
break;
|
|
41
37
|
case DAlignHorizontal.CENTER:
|
|
42
|
-
this.center.add(image,
|
|
38
|
+
this.center.add(image, bound, margin.horizontal);
|
|
43
39
|
break;
|
|
44
40
|
case DAlignHorizontal.RIGHT:
|
|
45
|
-
this.right.add(image,
|
|
41
|
+
this.right.add(image, bound, margin.horizontal);
|
|
46
42
|
break;
|
|
47
43
|
}
|
|
48
|
-
switch (
|
|
44
|
+
switch (align.vertical) {
|
|
49
45
|
case DAlignVertical.TOP:
|
|
50
|
-
this.top.add(image,
|
|
46
|
+
this.top.add(image, bound, margin.vertical);
|
|
51
47
|
break;
|
|
52
48
|
case DAlignVertical.MIDDLE:
|
|
53
|
-
this.middle.add(image,
|
|
49
|
+
this.middle.add(image, bound, margin.vertical);
|
|
54
50
|
break;
|
|
55
51
|
case DAlignVertical.BOTTOM:
|
|
56
|
-
this.bottom.add(image,
|
|
52
|
+
this.bottom.add(image, bound, margin.vertical);
|
|
57
53
|
break;
|
|
58
54
|
}
|
|
59
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-image-piece-layouter-part-container.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-image-piece-layouter-part-container.ts"],"names":[],"mappings":"AAAA,OAAO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ACF,CAAC;IACF,uCAAC;AAAD,CAAC,AAjMD,IAiMC","sourcesContent":["import { DAlignHorizontal } from \"./d-align-horizontal\";\nimport { DAlignVertical } from \"./d-align-vertical\";\nimport { DDynamicText } from \"./d-dynamic-text\";\nimport { DImagePiece } from \"./d-image-piece\";\nimport { DImagePieceLayouterPartBottom } from \"./d-image-piece-layouter-part-bottom\";\nimport { DImagePieceLayouterPartCenter } from \"./d-image-piece-layouter-part-center\";\nimport { DImagePieceLayouterPartLeft } from \"./d-image-piece-layouter-part-left\";\nimport { DImagePieceLayouterPartMiddle } from \"./d-image-piece-layouter-part-middle\";\nimport { DImagePieceLayouterPartRight } from \"./d-image-piece-layouter-part-right\";\nimport { DImagePieceLayouterPartTop } from \"./d-image-piece-layouter-part-top\";\nimport { DTextBaseAlign } from \"./d-text-base\";\n\nexport class DImagePieceLayouterPartContainer {\n\tleft: DImagePieceLayouterPartLeft;\n\tcenter: DImagePieceLayouterPartCenter;\n\tright: DImagePieceLayouterPartRight;\n\ttop: DImagePieceLayouterPartTop;\n\tmiddle: DImagePieceLayouterPartMiddle;\n\tbottom: DImagePieceLayouterPartBottom;\n\n\ttext?: DDynamicText | null;\n\n\tconstructor() {\n\t\tthis.left = new DImagePieceLayouterPartLeft();\n\t\tthis.center = new DImagePieceLayouterPartCenter();\n\t\tthis.right = new DImagePieceLayouterPartRight();\n\t\tthis.top = new DImagePieceLayouterPartTop();\n\t\tthis.middle = new DImagePieceLayouterPartMiddle();\n\t\tthis.bottom = new DImagePieceLayouterPartBottom();\n\t}\n\n\tclear(): void {\n\t\tthis.left.clear();\n\t\tthis.center.clear();\n\t\tthis.right.clear();\n\t\tthis.top.clear();\n\t\tthis.middle.clear();\n\t\tthis.bottom.clear();\n\t\tthis.text = undefined;\n\t}\n\n\tadd(image: DImagePiece): void {\n\t\tconst imageImage = image.image;\n\t\tif (imageImage != null) {\n\t\t\tconst imageBound = image.bound;\n\t\t\tconst imageBoundWidth = imageBound.width;\n\t\t\tconst imageBoundHeight = imageBound.height;\n\n\t\t\tconst imageMargin = image.margin;\n\t\t\tconst imageMarginHorizontal = imageMargin.horizontal;\n\t\t\tconst imageMarginVertical = imageMargin.vertical;\n\n\t\t\tconst imageAlign = image.align;\n\t\t\tswitch (imageAlign.horizontal) {\n\t\t\t\tcase DAlignHorizontal.LEFT:\n\t\t\t\t\tthis.left.add(image, imageBoundWidth, imageMarginHorizontal);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.CENTER:\n\t\t\t\t\tthis.center.add(image, imageBoundWidth, imageMarginHorizontal);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.RIGHT:\n\t\t\t\t\tthis.right.add(image, imageBoundWidth, imageMarginHorizontal);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tswitch (imageAlign.vertical) {\n\t\t\t\tcase DAlignVertical.TOP:\n\t\t\t\t\tthis.top.add(image, imageBoundHeight, imageMarginVertical);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.MIDDLE:\n\t\t\t\t\tthis.middle.add(image, imageBoundHeight, imageMarginVertical);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.BOTTOM:\n\t\t\t\t\tthis.bottom.add(image, imageBoundHeight, imageMarginVertical);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tset(text: DDynamicText | null): void {\n\t\tthis.left.set(text);\n\t\tthis.center.set(text);\n\t\tthis.right.set(text);\n\t\tthis.top.set(text);\n\t\tthis.middle.set(text);\n\t\tthis.bottom.set(text);\n\t\tthis.text = text;\n\t}\n\n\tget width(): number {\n\t\tconst text = this.text;\n\t\tconst left = this.left;\n\t\tconst leftSize = left.size;\n\t\tconst center = this.center;\n\t\tconst centerSize = center.size;\n\t\tconst right = this.right;\n\t\tconst rightSize = right.size;\n\t\tif (text !== undefined) {\n\t\t\tif (text !== null) {\n\t\t\t\treturn Math.max(leftSize + text.width + rightSize, centerSize);\n\t\t\t} else {\n\t\t\t\treturn Math.max(leftSize + rightSize, centerSize);\n\t\t\t}\n\t\t} else {\n\t\t\treturn Math.max(leftSize, rightSize, centerSize);\n\t\t}\n\t}\n\n\tget height(): number {\n\t\tconst text = this.text;\n\t\tconst top = this.top;\n\t\tconst topSize = top.size;\n\t\tconst middle = this.middle;\n\t\tconst middleSize = middle.size;\n\t\tconst bottom = this.bottom;\n\t\tconst bottomSize = bottom.size;\n\t\tif (text !== undefined) {\n\t\t\tif (text !== null) {\n\t\t\t\treturn Math.max(topSize + text.height + bottomSize, middleSize);\n\t\t\t} else {\n\t\t\t\treturn Math.max(topSize + bottomSize, middleSize);\n\t\t\t}\n\t\t} else {\n\t\t\treturn Math.max(topSize, bottomSize, middleSize);\n\t\t}\n\t}\n\n\texecute(\n\t\tpleft: number,\n\t\tptop: number,\n\t\tpright: number,\n\t\tpbottom: number,\n\t\ttextAlign: DTextBaseAlign,\n\t\twidth: number,\n\t\theight: number\n\t): void {\n\t\tconst left = this.left;\n\t\tconst center = this.center;\n\t\tconst right = this.right;\n\t\tconst top = this.top;\n\t\tconst middle = this.middle;\n\t\tconst bottom = this.bottom;\n\n\t\tconst text = this.text;\n\t\tif (text !== undefined) {\n\t\t\tconst leftSize = left.size;\n\t\t\tconst rightSize = right.size;\n\t\t\tconst topSize = top.size;\n\t\t\tconst bottomSize = bottom.size;\n\n\t\t\tlet textX = 0;\n\t\t\tlet textWidth = 0;\n\t\t\tlet textHeight = 0;\n\t\t\tif (text != null) {\n\t\t\t\ttextWidth = text.width;\n\t\t\t\ttextHeight = text.height;\n\t\t\t}\n\t\t\tswitch (textAlign.horizontal) {\n\t\t\t\tcase DAlignHorizontal.LEFT:\n\t\t\t\t\ttextX = pleft + leftSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.CENTER:\n\t\t\t\t\ttextX =\n\t\t\t\t\t\tpleft +\n\t\t\t\t\t\t(width - pleft - pright - (leftSize + textWidth + rightSize)) * 0.5 +\n\t\t\t\t\t\tleftSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.RIGHT:\n\t\t\t\t\ttextX = width - pright - rightSize - textWidth;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tlet textY = 0;\n\t\t\tswitch (textAlign.vertical) {\n\t\t\t\tcase DAlignVertical.TOP:\n\t\t\t\t\ttextY = ptop + topSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.MIDDLE:\n\t\t\t\t\ttextY =\n\t\t\t\t\t\tptop +\n\t\t\t\t\t\t(height - ptop - pbottom - (topSize + textHeight + bottomSize)) * 0.5 +\n\t\t\t\t\t\ttopSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.BOTTOM:\n\t\t\t\t\ttextY = height - pbottom - bottomSize - textHeight;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (text != null) {\n\t\t\t\ttext.position.set(textX, textY);\n\t\t\t\ttext.setClippingDelta(leftSize + rightSize, topSize + bottomSize);\n\t\t\t}\n\t\t\tleft.execute(textX - leftSize);\n\t\t\tcenter.execute(0, 0, textX * 2 + textWidth);\n\t\t\tright.execute(0, textX + textWidth + rightSize);\n\t\t\ttop.execute(textY - topSize);\n\t\t\tmiddle.execute(0, 0, textY * 2 + textHeight);\n\t\t\tbottom.execute(0, textY + textHeight + bottomSize);\n\t\t} else {\n\t\t\tleft.execute(pleft);\n\t\t\tcenter.execute(pleft, pright, width);\n\t\t\tright.execute(pright, width);\n\t\t\ttop.execute(ptop);\n\t\t\tmiddle.execute(ptop, pbottom, height);\n\t\t\tbottom.execute(pbottom, height);\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"d-image-piece-layouter-part-container.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-image-piece-layouter-part-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAA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AQ,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAChC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,GAAG,SAAS,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC;aAClE;YACD,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,CAAC;YAC/B,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC;YAC5C,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC;YAChD,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC;YAC7B,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC;YAC7C,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC;SACnD;aAAM;YACN,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;YACrC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAC7B,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;YACtC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAChC;IACF,CAAC;IACF,uCAAC;AAAD,CAAC,AA3LD,IA2LC","sourcesContent":["import { DAlignHorizontal } from \"./d-align-horizontal\";\nimport { DAlignVertical } from \"./d-align-vertical\";\nimport { DDynamicText } from \"./d-dynamic-text\";\nimport { DImagePiece } from \"./d-image-piece\";\nimport { DImagePieceLayouterPartBottom } from \"./d-image-piece-layouter-part-bottom\";\nimport { DImagePieceLayouterPartCenter } from \"./d-image-piece-layouter-part-center\";\nimport { DImagePieceLayouterPartLeft } from \"./d-image-piece-layouter-part-left\";\nimport { DImagePieceLayouterPartMiddle } from \"./d-image-piece-layouter-part-middle\";\nimport { DImagePieceLayouterPartRight } from \"./d-image-piece-layouter-part-right\";\nimport { DImagePieceLayouterPartTop } from \"./d-image-piece-layouter-part-top\";\nimport { DTextBaseAlign } from \"./d-text-base\";\n\nexport class DImagePieceLayouterPartContainer {\n\tleft: DImagePieceLayouterPartLeft;\n\tcenter: DImagePieceLayouterPartCenter;\n\tright: DImagePieceLayouterPartRight;\n\ttop: DImagePieceLayouterPartTop;\n\tmiddle: DImagePieceLayouterPartMiddle;\n\tbottom: DImagePieceLayouterPartBottom;\n\n\ttext?: DDynamicText | null;\n\n\tconstructor() {\n\t\tthis.left = new DImagePieceLayouterPartLeft();\n\t\tthis.center = new DImagePieceLayouterPartCenter();\n\t\tthis.right = new DImagePieceLayouterPartRight();\n\t\tthis.top = new DImagePieceLayouterPartTop();\n\t\tthis.middle = new DImagePieceLayouterPartMiddle();\n\t\tthis.bottom = new DImagePieceLayouterPartBottom();\n\t}\n\n\tclear(): void {\n\t\tthis.left.clear();\n\t\tthis.center.clear();\n\t\tthis.right.clear();\n\t\tthis.top.clear();\n\t\tthis.middle.clear();\n\t\tthis.bottom.clear();\n\t\tthis.text = undefined;\n\t}\n\n\tadd(image: DImagePiece): void {\n\t\tconst object = image.object;\n\t\tif (object != null) {\n\t\t\tconst bound = object.getLocalBounds();\n\t\t\tconst margin = image.margin;\n\t\t\tconst align = image.align;\n\t\t\tswitch (align.horizontal) {\n\t\t\t\tcase DAlignHorizontal.LEFT:\n\t\t\t\t\tthis.left.add(image, bound, margin.horizontal);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.CENTER:\n\t\t\t\t\tthis.center.add(image, bound, margin.horizontal);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.RIGHT:\n\t\t\t\t\tthis.right.add(image, bound, margin.horizontal);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tswitch (align.vertical) {\n\t\t\t\tcase DAlignVertical.TOP:\n\t\t\t\t\tthis.top.add(image, bound, margin.vertical);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.MIDDLE:\n\t\t\t\t\tthis.middle.add(image, bound, margin.vertical);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.BOTTOM:\n\t\t\t\t\tthis.bottom.add(image, bound, margin.vertical);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tset(text: DDynamicText | null): void {\n\t\tthis.left.set(text);\n\t\tthis.center.set(text);\n\t\tthis.right.set(text);\n\t\tthis.top.set(text);\n\t\tthis.middle.set(text);\n\t\tthis.bottom.set(text);\n\t\tthis.text = text;\n\t}\n\n\tget width(): number {\n\t\tconst text = this.text;\n\t\tconst left = this.left;\n\t\tconst leftSize = left.size;\n\t\tconst center = this.center;\n\t\tconst centerSize = center.size;\n\t\tconst right = this.right;\n\t\tconst rightSize = right.size;\n\t\tif (text !== undefined) {\n\t\t\tif (text !== null) {\n\t\t\t\treturn Math.max(leftSize + text.width + rightSize, centerSize);\n\t\t\t} else {\n\t\t\t\treturn Math.max(leftSize + rightSize, centerSize);\n\t\t\t}\n\t\t} else {\n\t\t\treturn Math.max(leftSize, rightSize, centerSize);\n\t\t}\n\t}\n\n\tget height(): number {\n\t\tconst text = this.text;\n\t\tconst top = this.top;\n\t\tconst topSize = top.size;\n\t\tconst middle = this.middle;\n\t\tconst middleSize = middle.size;\n\t\tconst bottom = this.bottom;\n\t\tconst bottomSize = bottom.size;\n\t\tif (text !== undefined) {\n\t\t\tif (text !== null) {\n\t\t\t\treturn Math.max(topSize + text.height + bottomSize, middleSize);\n\t\t\t} else {\n\t\t\t\treturn Math.max(topSize + bottomSize, middleSize);\n\t\t\t}\n\t\t} else {\n\t\t\treturn Math.max(topSize, bottomSize, middleSize);\n\t\t}\n\t}\n\n\texecute(\n\t\tpleft: number,\n\t\tptop: number,\n\t\tpright: number,\n\t\tpbottom: number,\n\t\ttextAlign: DTextBaseAlign,\n\t\twidth: number,\n\t\theight: number\n\t): void {\n\t\tconst left = this.left;\n\t\tconst center = this.center;\n\t\tconst right = this.right;\n\t\tconst top = this.top;\n\t\tconst middle = this.middle;\n\t\tconst bottom = this.bottom;\n\n\t\tconst text = this.text;\n\t\tif (text !== undefined) {\n\t\t\tconst leftSize = left.size;\n\t\t\tconst rightSize = right.size;\n\t\t\tconst topSize = top.size;\n\t\t\tconst bottomSize = bottom.size;\n\n\t\t\tlet textX = 0;\n\t\t\tlet textWidth = 0;\n\t\t\tlet textHeight = 0;\n\t\t\tif (text != null) {\n\t\t\t\ttextWidth = text.width;\n\t\t\t\ttextHeight = text.height;\n\t\t\t}\n\t\t\tswitch (textAlign.horizontal) {\n\t\t\t\tcase DAlignHorizontal.LEFT:\n\t\t\t\t\ttextX = pleft + leftSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.CENTER:\n\t\t\t\t\ttextX =\n\t\t\t\t\t\tpleft +\n\t\t\t\t\t\t(width - pleft - pright - (leftSize + textWidth + rightSize)) * 0.5 +\n\t\t\t\t\t\tleftSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.RIGHT:\n\t\t\t\t\ttextX = width - pright - rightSize - textWidth;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tlet textY = 0;\n\t\t\tswitch (textAlign.vertical) {\n\t\t\t\tcase DAlignVertical.TOP:\n\t\t\t\t\ttextY = ptop + topSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.MIDDLE:\n\t\t\t\t\ttextY =\n\t\t\t\t\t\tptop +\n\t\t\t\t\t\t(height - ptop - pbottom - (topSize + textHeight + bottomSize)) * 0.5 +\n\t\t\t\t\t\ttopSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.BOTTOM:\n\t\t\t\t\ttextY = height - pbottom - bottomSize - textHeight;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (text != null) {\n\t\t\t\ttext.position.set(textX, textY);\n\t\t\t\ttext.setClippingDelta(leftSize + rightSize, topSize + bottomSize);\n\t\t\t}\n\t\t\tleft.execute(textX - leftSize);\n\t\t\tcenter.execute(0, 0, textX * 2 + textWidth);\n\t\t\tright.execute(0, textX + textWidth + rightSize);\n\t\t\ttop.execute(textY - topSize);\n\t\t\tmiddle.execute(0, 0, textY * 2 + textHeight);\n\t\t\tbottom.execute(0, textY + textHeight + bottomSize);\n\t\t} else {\n\t\t\tleft.execute(pleft);\n\t\t\tcenter.execute(pleft, pright, width);\n\t\t\tright.execute(pright, width);\n\t\t\ttop.execute(ptop);\n\t\t\tmiddle.execute(ptop, pbottom, height);\n\t\t\tbottom.execute(pbottom, height);\n\t\t}\n\t}\n}\n"]}
|