B4i Library Zoomable ImageView

Hi All,

Please find attached a new Class which will allow to have Zoomable Images like in popular apps.

Please see the attached exemple.

If MinScale and MaxScale are not set the default values are Minscale to fit the View size and MaxScale is 1.

Please ask if you have any questions.

As the Upload limitations are not so high I can not upload an image with the example so you have to put your own.

Narek
 

Attachments

  • libZOOM.zip
    2.9 KB · Views: 358

Descartex

Well-Known Member
Licensed User
Longtime User
Simply perfect.
Thanks in tons!!!
 

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Hello Narek,

What is wrong in this code? I can´t see the picture

B4X:
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
    NavControl.ShowPage(Page1)
  
   imgZoom.Initialize(LoadBitmap(File.DirAssets,"Alberto.JPG"))
   imgZoom.MinScale = 1
   imgZoom.MaxScale = 10.0
   imgZoom.UnZOOMonDoubleTap = True
   imgZoom.AddToView(Page1.RootPanel, 0, 0, Page1.RootPanel.Width, Page1.RootPanel.Height)

Thanks
 

narek adonts

Well-Known Member
Licensed User
Longtime User
Hello Narek,

What is wrong in this code? I can´t see the picture

B4X:
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
    NavControl.ShowPage(Page1)
 
   imgZoom.Initialize(LoadBitmap(File.DirAssets,"Alberto.JPG"))
   imgZoom.MinScale = 1
   imgZoom.MaxScale = 10.0
   imgZoom.UnZOOMonDoubleTap = True
   imgZoom.AddToView(Page1.RootPanel, 0, 0, Page1.RootPanel.Width, Page1.RootPanel.Height)

Thanks

I think you should not add the view in appstart as page.width and height should be 0
 

Graham Bancroft

Member
Licensed User
Longtime User
ZoomedImage
Narek, I have the following issue, when I Zoom I want the Whole Image viewable/Scrollable, so that I can read small text. I can only view less and less moving up to upper left of image. In my B4a App, the whole image is Zoomed larger and available by scrolling left/right or up/down
see attached problem.png

Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
NavControl.ShowPage(Page1)
'imgZoom.Initialize(Null)
imgZoom.Initialize(LoadBitmap(File.DirAssets,"appendix1a.jpg"))
imgZoom.AddToView(Page1.RootPanel,0,0,100%x,100%y)
'imgZoom.Bitmap= YourBitmap
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
End Sub

I am using your libImageZoom from above. Regards Graham
 

Attachments

  • problem.png
    problem.png
    143.2 KB · Views: 27
Top