mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor: update safe area traces
This commit is contained in:
committed by
Martin Yankov
parent
a610c6f0c3
commit
bf070f105d
@@ -1,3 +1,7 @@
|
|||||||
import * as application from "tns-core-modules/application";
|
import * as application from "tns-core-modules/application";
|
||||||
|
import * as trace from "tns-core-modules/trace";
|
||||||
|
|
||||||
|
trace.setCategories(trace.categories.Layout);
|
||||||
|
trace.enable();
|
||||||
|
|
||||||
application.run({ moduleName: "app-root" });
|
application.run({ moduleName: "app-root" });
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ export class View extends ViewCommon {
|
|||||||
public _setNativeViewFrame(nativeView: UIView, frame: CGRect): void {
|
public _setNativeViewFrame(nativeView: UIView, frame: CGRect): void {
|
||||||
if (!CGRectEqualToRect(nativeView.frame, frame)) {
|
if (!CGRectEqualToRect(nativeView.frame, frame)) {
|
||||||
if (traceEnabled()) {
|
if (traceEnabled()) {
|
||||||
traceWrite(this + ", Native setFrame: = " + NSStringFromCGRect(frame), traceCategories.Layout);
|
traceWrite(this + " :_setNativeViewFrame: " + JSON.stringify(ios.getPositionFromFrame(frame)), traceCategories.Layout);
|
||||||
}
|
}
|
||||||
this._cachedFrame = frame;
|
this._cachedFrame = frame;
|
||||||
if (this._hasTransfrom) {
|
if (this._hasTransfrom) {
|
||||||
@@ -231,6 +231,11 @@ export class View extends ViewCommon {
|
|||||||
if (insets.left || insets.top) {
|
if (insets.left || insets.top) {
|
||||||
const position = ios.getPositionFromFrame(frame);
|
const position = ios.getPositionFromFrame(frame);
|
||||||
const adjustedFrame = ios.getFrameFromPosition(position, insets);
|
const adjustedFrame = ios.getFrameFromPosition(position, insets);
|
||||||
|
|
||||||
|
if (traceEnabled()) {
|
||||||
|
traceWrite(this + " :applySafeAreaInsets: " + JSON.stringify(ios.getPositionFromFrame(adjustedFrame)), traceCategories.Layout);
|
||||||
|
}
|
||||||
|
|
||||||
return adjustedFrame;
|
return adjustedFrame;
|
||||||
}
|
}
|
||||||
} else if (this.nativeViewProtected && this.nativeViewProtected.window) {
|
} else if (this.nativeViewProtected && this.nativeViewProtected.window) {
|
||||||
@@ -261,6 +266,11 @@ export class View extends ViewCommon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const adjustedFrame = CGRectMake(layout.toDeviceIndependentPixels(adjustedPosition.left), layout.toDeviceIndependentPixels(adjustedPosition.top), layout.toDeviceIndependentPixels(adjustedPosition.right - adjustedPosition.left), layout.toDeviceIndependentPixels(adjustedPosition.bottom - adjustedPosition.top));
|
const adjustedFrame = CGRectMake(layout.toDeviceIndependentPixels(adjustedPosition.left), layout.toDeviceIndependentPixels(adjustedPosition.top), layout.toDeviceIndependentPixels(adjustedPosition.right - adjustedPosition.left), layout.toDeviceIndependentPixels(adjustedPosition.bottom - adjustedPosition.top));
|
||||||
|
|
||||||
|
if (traceEnabled()) {
|
||||||
|
traceWrite(this + " :applySafeAreaInsets: " + JSON.stringify(ios.getPositionFromFrame(adjustedFrame)), traceCategories.Layout);
|
||||||
|
}
|
||||||
|
|
||||||
return adjustedFrame;
|
return adjustedFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user