|
1 | | -import { CSSType, Color, Device, Font, ImageSource, View } from '@nativescript/core'; |
2 | | -import { android as androidApp } from '@nativescript/core/application'; |
3 | | -import { FontStyle, FontStyleType, FontWeight, FontWeightType } from '@nativescript/core/ui/styling/font'; |
| 1 | +import { Application, CSSType, Color, Device, Font, ImageSource, Utils, View } from '@nativescript/core'; |
4 | 2 | import lazy from '@nativescript/core/utils/lazy'; |
5 | | -import { layout } from '@nativescript/core/utils/layout-helper'; |
6 | 3 | import { Canvas as ICanvas, Paint as IPaint } from './canvas'; |
7 | 4 | import { CanvasBase, hardwareAcceleratedProperty } from './canvas.common'; |
8 | 5 |
|
9 | 6 | import { arrayToNativeArray } from '@nativescript-community/arraybuffers'; |
| 7 | +import { FontStyleType, FontWeightType } from '@nativescript/core/ui/styling/font-interfaces'; |
10 | 8 |
|
11 | 9 | declare global { |
12 | 10 | const __runtimeVersion: string; |
@@ -74,7 +72,7 @@ function createColorParam(param) { |
74 | 72 | // } |
75 | 73 | function drawViewOnCanvas(canvas: android.graphics.Canvas, view: View, rect?: android.graphics.Rect) { |
76 | 74 | if (!view.nativeView) { |
77 | | - const activity = androidApp.foregroundActivity; |
| 75 | + const activity = Application.android.foregroundActivity; |
78 | 76 | (view as any)._setupAsRootView(activity); |
79 | 77 | (view as any)._isAddedToNativeVisualTree = true; |
80 | 78 | (view as any).callLoaded(); |
@@ -170,7 +168,7 @@ class Canvas extends ProxyClass<android.graphics.Canvas> { |
170 | 168 | } |
171 | 169 | } else if (methodName === 'getWidth' || methodName === 'getHeight') { |
172 | 170 | if (!target._bitmap) { |
173 | | - return layout.toDeviceIndependentPixels(native[methodName]()); |
| 171 | + return Utils.layout.toDeviceIndependentPixels(native[methodName]()); |
174 | 172 | } |
175 | 173 | } else if (methodName === 'clear') { |
176 | 174 | native.drawColor(android.graphics.Color.TRANSPARENT); |
@@ -519,7 +517,7 @@ class CanvasView extends CanvasBase { |
519 | 517 | super.initNativeView(); |
520 | 518 | this.nativeViewProtected.sizeChangedListener = new com.akylas.canvas.SizeChangedListener({ |
521 | 519 | onSizeChanged: (w, h, oldW, oldH) => { |
522 | | - this.onSizeChanged(layout.toDeviceIndependentPixels(w), layout.toDeviceIndependentPixels(h), oldW, oldH); |
| 520 | + this.onSizeChanged(Utils.layout.toDeviceIndependentPixels(w), Utils.layout.toDeviceIndependentPixels(h), oldW, oldH); |
523 | 521 | } |
524 | 522 | }); |
525 | 523 | this.nativeViewProtected.drawListener = new com.akylas.canvas.DrawListener({ |
|
0 commit comments