@@ -3,9 +3,7 @@ import { ZoomImageBase, maxZoomScaleProperty, minZoomScaleProperty, zoomScalePro
33
44export class ZoomImg extends ZoomImageBase {
55 mNeedUpdateHierarchy = true ;
6- //@ts -ignore
76 nativeViewProtected : com . facebook . samples . zoomable . ZoomableDraweeView ;
8- //@ts -ignore
97 nativeImageViewProtected : com . facebook . samples . zoomable . ZoomableDraweeView ;
108 public createNativeView ( ) {
119 //@ts -ignore
@@ -16,19 +14,25 @@ export class ZoomImg extends ZoomImageBase {
1614 view . setTapListener ( new com . facebook . samples . zoomable . DoubleTapGestureListener ( view ) ) ;
1715 return view ;
1816 }
17+ getController ( ) {
18+ return this . nativeViewProtected ?. getZoomableController ( ) as com . facebook . samples . zoomable . DefaultZoomableController ;
19+ }
1920
2021 [ zoomScaleProperty . setNative ] ( scale : number ) {
2122 //possible?
2223 // if (this.nativeViewProtected) {
2324 // this.nativeViewProtected.getZoomableController().setMinScaleFactor(scale);
2425 // }
26+ this . getController ( ) . zoomToPoint ( scale , new android . graphics . PointF ( 0 , 0 ) , new android . graphics . PointF ( 0 , 0 ) ) ;
27+ }
28+ setZoom ( scale : number , animated = true , point : { x ; y } = { x : 0 , y : 0 } ) {
29+ this . getController ( ) . zoomToPoint ( scale , new android . graphics . PointF ( point . x , point . y ) , new android . graphics . PointF ( 0 , 0 ) ) ;
2530 }
26-
2731 [ minZoomScaleProperty . setNative ] ( scale : number ) {
28- this . nativeViewProtected . getZoomableController ( ) . setMinScaleFactor ( scale ) ;
32+ this . getController ( ) . setMinScaleFactor ( scale ) ;
2933 }
3034
3135 [ maxZoomScaleProperty . setNative ] ( scale : number ) {
32- this . nativeViewProtected . getZoomableController ( ) . setMaxScaleFactor ( scale ) ;
36+ this . getController ( ) . setMaxScaleFactor ( scale ) ;
3337 }
3438}
0 commit comments