Skip to content

Commit ad59928

Browse files
authored
Merge pull request #60 from nativescript-community/fix-bitmap-width-height
fix(ui-canvas): Incorrect values for bitmap getWidth/getHeight
2 parents d61a59f + b873a37 commit ad59928

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ui-canvas/canvas.android.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class Canvas extends ProxyClass<android.graphics.Canvas> {
122122

123123
return this;
124124
}
125-
override handleCustomMethods(target, native, methodName, args): any {
125+
override handleCustomMethods(target: Canvas, native, methodName, args): any {
126126
if (methodName === 'setBitmap') {
127127
if (args[0] instanceof ImageSource) {
128128
args[0] = args[0].android;
@@ -136,7 +136,7 @@ class Canvas extends ProxyClass<android.graphics.Canvas> {
136136
args.pop();
137137
}
138138
} else if (methodName === 'getWidth' || methodName === 'getHeight') {
139-
if (!target._bitmap) {
139+
if (!target.mBitmap) {
140140
return Utils.layout.toDeviceIndependentPixels(native[methodName]());
141141
}
142142
} else if (methodName === 'clear') {
@@ -198,7 +198,7 @@ export class Paint extends ProxyClass<android.graphics.Paint> {
198198
this.mNative.setLinearText(true); // ensure we are drawing fonts correctly
199199
return this;
200200
}
201-
handleCustomMethods(target, native, methodName: string, args: any[]): any {
201+
handleCustomMethods(target: Paint, native, methodName: string, args: any[]): any {
202202
if (methodName === 'setColor') {
203203
if (!args[0]) {
204204
return;

0 commit comments

Comments
 (0)