@nativescript-rtl/ui
Version:
Add right-to-left support to NativeScript framework
56 lines • 2.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DockLayout = void 0;
const dock_layout_common_1 = require("./dock-layout.common");
const platform_1 = require("@nativescript/core/platform");
class DockLayout extends dock_layout_common_1.Common {
initNativeView() {
super.initNativeView();
this.scheduleDirectionUpdate();
}
[dock_layout_common_1.isRtlProperty.setNative](isRtl) {
this.isRtl = isRtl;
this.scheduleDirectionUpdate();
}
addChild(view) {
super.addChild(view);
if (view.nativeViewProtected) {
this.scheduleDirectionUpdate();
}
}
removeChild(view) {
super.removeChild(view);
if (view.nativeViewProtected) {
this.scheduleDirectionUpdate();
}
}
_updateDirection() {
let ZeroRotation = CATransform3DRotate(CATransform3DIdentity, 0.0, 0.0, 0.0, 0.0);
let RotationInYAxis180Deg = CATransform3DRotate(CATransform3DIdentity, (180 * Math.PI) / 180.0, 0.0, 1.0, 0.0);
if (this.isRtl) {
this.nativeViewProtected.layer.transform = RotationInYAxis180Deg;
for (let viewIndex = 0; viewIndex < this["getChildrenCount"](); viewIndex++) {
let NSView = this["getChildAt"](viewIndex);
let isRtl = NSView["isRtl"] || false;
if (isRtl) {
NSView.nativeView.layer.transform = ZeroRotation;
}
else {
NSView.nativeView.layer.transform = RotationInYAxis180Deg;
}
NSView.nativeViewProtected.layer.rasterizationScale = platform_1.Screen.mainScreen.scale;
}
this.nativeViewProtected.layer.rasterizationScale = platform_1.Screen.mainScreen.scale;
}
else {
this.nativeViewProtected.layer.transform = ZeroRotation;
for (let viewIndex = 0; viewIndex < this["getChildrenCount"](); viewIndex++) {
let NSView = this["getChildAt"](viewIndex);
NSView.nativeView.layer.transform = ZeroRotation;
NSView.nativeViewProtected.layer.rasterizationScale = platform_1.Screen.mainScreen.scale;
}
}
}
}
exports.DockLayout = DockLayout;
//# sourceMappingURL=dock-layout.ios.js.map