laymur 0.2.4 → 0.2.5
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.js
CHANGED
|
@@ -2238,6 +2238,8 @@ class UISolverWrapper {
|
|
|
2238
2238
|
*/
|
|
2239
2239
|
var UILayerEvent;
|
|
2240
2240
|
(function (UILayerEvent) {
|
|
2241
|
+
/** Emitted when the layer's orientation is about to change between horizontal and vertical. */
|
|
2242
|
+
UILayerEvent["WILL_ORIENTATION_CHANGE"] = "will_orientation_change";
|
|
2241
2243
|
/** Emitted when the layer's orientation changes between horizontal and vertical. */
|
|
2242
2244
|
UILayerEvent["ORIENTATION_CHANGE"] = "orientation_change";
|
|
2243
2245
|
/** Emitted when the layer's visibility/interaction mode changes. */
|
|
@@ -2347,6 +2349,7 @@ class UILayer extends i {
|
|
|
2347
2349
|
this.sceneWrapper.resize(width, height);
|
|
2348
2350
|
const orientation = width > height ? UIOrientation.HORIZONTAL : UIOrientation.VERTICAL;
|
|
2349
2351
|
if (orientation !== this.orientationInternal) {
|
|
2352
|
+
this.emit(UILayerEvent.WILL_ORIENTATION_CHANGE, this.orientationInternal, this);
|
|
2350
2353
|
this.orientationInternal = orientation;
|
|
2351
2354
|
this.emit(UILayerEvent.ORIENTATION_CHANGE, this.orientationInternal, this);
|
|
2352
2355
|
}
|
|
@@ -2465,6 +2468,11 @@ class UISingleParameterConstraint extends UIConstraint {
|
|
|
2465
2468
|
*/
|
|
2466
2469
|
constructor(layer, priority, relation, orientation) {
|
|
2467
2470
|
super(layer);
|
|
2471
|
+
this._private_onWillOrientationChange = () => {
|
|
2472
|
+
if (!this.isConstraintEnabled()) {
|
|
2473
|
+
this.solverWrapper.setConstraintEnabled(this.constraint, false);
|
|
2474
|
+
}
|
|
2475
|
+
};
|
|
2468
2476
|
/**
|
|
2469
2477
|
* Event handler for layer orientation changes.
|
|
2470
2478
|
*
|
|
@@ -2474,12 +2482,15 @@ class UISingleParameterConstraint extends UIConstraint {
|
|
|
2474
2482
|
* @private
|
|
2475
2483
|
*/
|
|
2476
2484
|
this._private_onOrientationChange = () => {
|
|
2477
|
-
|
|
2485
|
+
if (this.isConstraintEnabled()) {
|
|
2486
|
+
this.solverWrapper.setConstraintEnabled(this.constraint, true);
|
|
2487
|
+
}
|
|
2478
2488
|
};
|
|
2479
2489
|
this.priorityInternal = resolvePriority(priority);
|
|
2480
2490
|
this.relationInternal = resolveRelation(relation);
|
|
2481
2491
|
this.orientationInternal = resolveOrientation(orientation);
|
|
2482
2492
|
this.layer.on(UILayerEvent.ORIENTATION_CHANGE, this._private_onOrientationChange);
|
|
2493
|
+
this.layer.on(UILayerEvent.WILL_ORIENTATION_CHANGE, this._private_onWillOrientationChange);
|
|
2483
2494
|
}
|
|
2484
2495
|
/**
|
|
2485
2496
|
* Gets the current priority level of the constraint.
|
|
@@ -2541,6 +2552,7 @@ class UISingleParameterConstraint extends UIConstraint {
|
|
|
2541
2552
|
*/
|
|
2542
2553
|
destroy() {
|
|
2543
2554
|
this.layer.off(UILayerEvent.ORIENTATION_CHANGE, this._private_onOrientationChange);
|
|
2555
|
+
this.layer.off(UILayerEvent.WILL_ORIENTATION_CHANGE, this._private_onWillOrientationChange);
|
|
2544
2556
|
this.solverWrapper.removeConstraint(this.constraint);
|
|
2545
2557
|
}
|
|
2546
2558
|
/**
|