laymur 0.11.0 → 0.11.2
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/index.d.ts +2 -0
- package/dist/index.js +94 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +22 -0
- package/dist/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +22 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -32,8 +32,10 @@ export { UIProgressMaskFunctionCircular } from "./miscellaneous/mask-function/UI
|
|
|
32
32
|
export { UIProgressMaskFunctionDirectional } from "./miscellaneous/mask-function/UIProgressMaskFunctionDirectional";
|
|
33
33
|
export { UIMicro } from "./miscellaneous/micro/UIMicro";
|
|
34
34
|
export { UIMicroAnchorMode } from "./miscellaneous/micro/UIMicro.Internal";
|
|
35
|
+
export { UIResizePolicyCover } from "./miscellaneous/resize-policy/UIResizePolicyCover";
|
|
35
36
|
export { UIResizePolicyCross } from "./miscellaneous/resize-policy/UIResizePolicyCross";
|
|
36
37
|
export { UIResizePolicyCrossInverted } from "./miscellaneous/resize-policy/UIResizePolicyCrossInverted";
|
|
38
|
+
export { UIResizePolicyFit } from "./miscellaneous/resize-policy/UIResizePolicyFit";
|
|
37
39
|
export { UIResizePolicyFixedHeight } from "./miscellaneous/resize-policy/UIResizePolicyFixedHeight";
|
|
38
40
|
export { UIResizePolicyFixedWidth } from "./miscellaneous/resize-policy/UIResizePolicyFixedWidth";
|
|
39
41
|
export { UIResizePolicyNone } from "./miscellaneous/resize-policy/UIResizePolicyNone";
|
package/dist/index.js
CHANGED
|
@@ -5763,7 +5763,7 @@ class UIGraphics extends UIElement {
|
|
|
5763
5763
|
*/
|
|
5764
5764
|
constructor(layer, options) {
|
|
5765
5765
|
const w = options?.width ?? DUMMY_DEFAULT_WIDTH;
|
|
5766
|
-
const h = options?.
|
|
5766
|
+
const h = options?.height ?? DUMMY_DEFAULT_HEIGHT;
|
|
5767
5767
|
const color = new UIColor(options?.color);
|
|
5768
5768
|
const canvas = new OffscreenCanvas(w, h);
|
|
5769
5769
|
const context = canvas.getContext("2d");
|
|
@@ -7724,6 +7724,52 @@ class UIProgressMaskFunctionCircular extends UIProgressMaskFunction {
|
|
|
7724
7724
|
}
|
|
7725
7725
|
}
|
|
7726
7726
|
|
|
7727
|
+
/** Scales area to cover rect preserving proportions */
|
|
7728
|
+
class UIResizePolicyCover extends UIResizePolicy {
|
|
7729
|
+
/**
|
|
7730
|
+
* Creates cover resize policy.
|
|
7731
|
+
*
|
|
7732
|
+
* @param rectWidth - Target rect width
|
|
7733
|
+
* @param rectHeight - Target rect height
|
|
7734
|
+
*/
|
|
7735
|
+
constructor(rectWidth, rectHeight) {
|
|
7736
|
+
super();
|
|
7737
|
+
assertValidPositiveNumber(rectWidth, "UIResizePolicyCover.constructor.rectWidth");
|
|
7738
|
+
assertValidPositiveNumber(rectHeight, "UIResizePolicyCover.constructor.rectHeight");
|
|
7739
|
+
this._private_rectWidthInternal = rectWidth;
|
|
7740
|
+
this._private_rectHeightInternal = rectHeight;
|
|
7741
|
+
}
|
|
7742
|
+
/** Target rect width */
|
|
7743
|
+
get rectWidth() {
|
|
7744
|
+
return this._private_rectWidthInternal;
|
|
7745
|
+
}
|
|
7746
|
+
/** Target rect height */
|
|
7747
|
+
get rectHeight() {
|
|
7748
|
+
return this._private_rectHeightInternal;
|
|
7749
|
+
}
|
|
7750
|
+
/** Target rect width */
|
|
7751
|
+
set rectWidth(value) {
|
|
7752
|
+
assertValidPositiveNumber(value, "UIResizePolicyCover.rectWidth");
|
|
7753
|
+
if (value !== this._private_rectWidthInternal) {
|
|
7754
|
+
this._private_rectWidthInternal = value;
|
|
7755
|
+
this.dirty = true;
|
|
7756
|
+
}
|
|
7757
|
+
}
|
|
7758
|
+
/** Target rect height */
|
|
7759
|
+
set rectHeight(value) {
|
|
7760
|
+
assertValidPositiveNumber(value, "UIResizePolicyCover.rectHeight");
|
|
7761
|
+
if (value !== this._private_rectHeightInternal) {
|
|
7762
|
+
this._private_rectHeightInternal = value;
|
|
7763
|
+
this.dirty = true;
|
|
7764
|
+
}
|
|
7765
|
+
}
|
|
7766
|
+
calculateScale(width, height) {
|
|
7767
|
+
assertValidPositiveNumber(width, "UIResizePolicyCover.calculateScale.width");
|
|
7768
|
+
assertValidPositiveNumber(height, "UIResizePolicyCover.calculateScale.height");
|
|
7769
|
+
return Math.min(this._private_rectWidthInternal / width, this._private_rectHeightInternal / height);
|
|
7770
|
+
}
|
|
7771
|
+
}
|
|
7772
|
+
|
|
7727
7773
|
/** Scales by width in landscape, by height in portrait */
|
|
7728
7774
|
class UIResizePolicyCross extends UIResizePolicy {
|
|
7729
7775
|
/**
|
|
@@ -7820,6 +7866,52 @@ class UIResizePolicyCrossInverted extends UIResizePolicy {
|
|
|
7820
7866
|
}
|
|
7821
7867
|
}
|
|
7822
7868
|
|
|
7869
|
+
/** Scales area to fit around rect preserving proportions */
|
|
7870
|
+
class UIResizePolicyFit extends UIResizePolicy {
|
|
7871
|
+
/**
|
|
7872
|
+
* Creates fit resize policy.
|
|
7873
|
+
*
|
|
7874
|
+
* @param rectWidth - Target rect width
|
|
7875
|
+
* @param rectHeight - Target rect height
|
|
7876
|
+
*/
|
|
7877
|
+
constructor(rectWidth, rectHeight) {
|
|
7878
|
+
super();
|
|
7879
|
+
assertValidPositiveNumber(rectWidth, "UIResizePolicyFit.constructor.rectWidth");
|
|
7880
|
+
assertValidPositiveNumber(rectHeight, "UIResizePolicyFit.constructor.rectHeight");
|
|
7881
|
+
this._private_rectWidthInternal = rectWidth;
|
|
7882
|
+
this._private_rectHeightInternal = rectHeight;
|
|
7883
|
+
}
|
|
7884
|
+
/** Target rect width */
|
|
7885
|
+
get rectWidth() {
|
|
7886
|
+
return this._private_rectWidthInternal;
|
|
7887
|
+
}
|
|
7888
|
+
/** Target rect height */
|
|
7889
|
+
get rectHeight() {
|
|
7890
|
+
return this._private_rectHeightInternal;
|
|
7891
|
+
}
|
|
7892
|
+
/** Target rect width */
|
|
7893
|
+
set rectWidth(value) {
|
|
7894
|
+
assertValidPositiveNumber(value, "UIResizePolicyFit.rectWidth");
|
|
7895
|
+
if (value !== this._private_rectWidthInternal) {
|
|
7896
|
+
this._private_rectWidthInternal = value;
|
|
7897
|
+
this.dirty = true;
|
|
7898
|
+
}
|
|
7899
|
+
}
|
|
7900
|
+
/** Target rect height */
|
|
7901
|
+
set rectHeight(value) {
|
|
7902
|
+
assertValidPositiveNumber(value, "UIResizePolicyFit.rectHeight");
|
|
7903
|
+
if (value !== this._private_rectHeightInternal) {
|
|
7904
|
+
this._private_rectHeightInternal = value;
|
|
7905
|
+
this.dirty = true;
|
|
7906
|
+
}
|
|
7907
|
+
}
|
|
7908
|
+
calculateScale(width, height) {
|
|
7909
|
+
assertValidPositiveNumber(width, "UIResizePolicyFit.calculateScale.width");
|
|
7910
|
+
assertValidPositiveNumber(height, "UIResizePolicyFit.calculateScale.height");
|
|
7911
|
+
return Math.max(this._private_rectWidthInternal / width, this._private_rectHeightInternal / height);
|
|
7912
|
+
}
|
|
7913
|
+
}
|
|
7914
|
+
|
|
7823
7915
|
/** Scales by height with orientation-specific targets */
|
|
7824
7916
|
class UIResizePolicyFixedHeight extends UIResizePolicy {
|
|
7825
7917
|
/**
|
|
@@ -7916,5 +8008,5 @@ class UIResizePolicyFixedWidth extends UIResizePolicy {
|
|
|
7916
8008
|
}
|
|
7917
8009
|
}
|
|
7918
8010
|
|
|
7919
|
-
export { UIAnchor, UIAnimatedImage, UIAreaCircle, UIAreaPolygon, UIAreaRectangle, UIAreaRoundedRectangle, UIAspectConstraint, UIColor, UIConstraint2DBuilder, UICoverConstraintBuilder, UICustomConstraint, UIDummy, UIExpression, UIFitConstraintBuilder, UIFullscreenLayer, UIGraphics, UIHeightConstraint, UIHorizontalDistanceConstraint, UIHorizontalProportionConstraint, UIImage, UIInputEvent, UIMicro, UIMicroAnchorMode, UIMode, UINineSlice, UINineSliceRegionMode, UIOrientation, UIPriority, UIProgress, UIProgressMaskFunctionCircular, UIProgressMaskFunctionDirectional, UIRelation, UIResizePolicyCross, UIResizePolicyCrossInverted, UIResizePolicyFixedHeight, UIResizePolicyFixedWidth, UIResizePolicyNone, UIScene, UISceneUpdateMode, UISingleParameterConstraint, UIText, UITextResizeMode, UITransparencyMode, UIVerticalDistanceConstraint, UIVerticalProportionConstraint, UIWidthConstraint };
|
|
8011
|
+
export { UIAnchor, UIAnimatedImage, UIAreaCircle, UIAreaPolygon, UIAreaRectangle, UIAreaRoundedRectangle, UIAspectConstraint, UIColor, UIConstraint2DBuilder, UICoverConstraintBuilder, UICustomConstraint, UIDummy, UIExpression, UIFitConstraintBuilder, UIFullscreenLayer, UIGraphics, UIHeightConstraint, UIHorizontalDistanceConstraint, UIHorizontalProportionConstraint, UIImage, UIInputEvent, UIMicro, UIMicroAnchorMode, UIMode, UINineSlice, UINineSliceRegionMode, UIOrientation, UIPriority, UIProgress, UIProgressMaskFunctionCircular, UIProgressMaskFunctionDirectional, UIRelation, UIResizePolicyCover, UIResizePolicyCross, UIResizePolicyCrossInverted, UIResizePolicyFit, UIResizePolicyFixedHeight, UIResizePolicyFixedWidth, UIResizePolicyNone, UIScene, UISceneUpdateMode, UISingleParameterConstraint, UIText, UITextResizeMode, UITransparencyMode, UIVerticalDistanceConstraint, UIVerticalProportionConstraint, UIWidthConstraint };
|
|
7920
8012
|
//# sourceMappingURL=index.js.map
|