Aug 29, 2011 Replies: 6 Hi all. Here's something i've been working on recently and decided to share. It's not a library or a code module but i thought it best posted in this forum anyway. HtmlImageView is a little piece of javascript that will turn a basic HTML element such as a DIV into a pannable and zoomable image viewer. The demo code shows off it's various features. The demo starts with a 'simple example' - an image is loaded and zoomed to a level where it fits the device screen. A double touch on the image will zoom in a level and a single touch will drag the image around the screen. I've added some buttons to the HTML to enable you to zoom in, zoom out, zoom to 100% size and zoom to fit the image to the device screen. Rotate your device though and the previous image position and zoom level are lost - the activity simply reloads as on FirstLoad. Hit the menu key and choose the 'advanced example' to see a better demo... The advanced example loads with a shot of Stonehenge (a Google Static maps image), all controls work as they did on the simple example. Pan or zoom the image and rotate your device - the previous image position and zoom level are restored when the activity is re-created. I've added a Spinner to the advanced example to enable you to choose from 6 available images. I've documented the javascript up to a point but not fully so if you want any help customising it just post in this thread and i'll try to help. Unfortunately there's no chance of pinch to zoom - the native WebView doesn't expose multi-touch events to the javscript engine. Actually i think that's changed with Honeycomb but for earlier Android versions multi-touch is a no no. Martin. Attachments HtmlImageView-v1.0.zip HtmlImageView-v1.0.zip 214.8 KB · Views: 984 Last edited: Sep 29, 2011 Click to expand...
Hi all. Here's something i've been working on recently and decided to share. It's not a library or a code module but i thought it best posted in this forum anyway. HtmlImageView is a little piece of javascript that will turn a basic HTML element such as a DIV into a pannable and zoomable image viewer. The demo code shows off it's various features. The demo starts with a 'simple example' - an image is loaded and zoomed to a level where it fits the device screen. A double touch on the image will zoom in a level and a single touch will drag the image around the screen. I've added some buttons to the HTML to enable you to zoom in, zoom out, zoom to 100% size and zoom to fit the image to the device screen. Rotate your device though and the previous image position and zoom level are lost - the activity simply reloads as on FirstLoad. Hit the menu key and choose the 'advanced example' to see a better demo... The advanced example loads with a shot of Stonehenge (a Google Static maps image), all controls work as they did on the simple example. Pan or zoom the image and rotate your device - the previous image position and zoom level are restored when the activity is re-created. I've added a Spinner to the advanced example to enable you to choose from 6 available images. I've documented the javascript up to a point but not fully so if you want any help customising it just post in this thread and i'll try to help. Unfortunately there's no chance of pinch to zoom - the native WebView doesn't expose multi-touch events to the javscript engine. Actually i think that's changed with Honeycomb but for earlier Android versions multi-touch is a no no. Martin.
G GioBarque New Member Licensed User Longtime User Sep 12, 2011 #2 Compiling Error I'm new to Basic4Android. I was trying to compile your file but I keep getting this error: Compiling code. Error Error parsing program. Error description: Unknown type: jsinterface Are you missing a library reference? Occurred on line: 18 Dim WebInterface As JSInterface :BangHead: Would you please let me know what I'm doing wrong?
Compiling Error I'm new to Basic4Android. I was trying to compile your file but I keep getting this error: Compiling code. Error Error parsing program. Error description: Unknown type: jsinterface Are you missing a library reference? Occurred on line: 18 Dim WebInterface As JSInterface :BangHead: Would you please let me know what I'm doing wrong?
warwound Expert Licensed User Longtime User Sep 12, 2011 #3 Hi. You need to download the JSInterface library: http://www.b4x.com/forum/additional-libraries-official-updates/9893-jsinterface.html Martin.
Hi. You need to download the JSInterface library: http://www.b4x.com/forum/additional-libraries-official-updates/9893-jsinterface.html Martin.
P philgoodgood Member Licensed User Longtime User Sep 29, 2011 #5 hi @warwound good job! opens up new possibilities for WebVie thanks for the sharing ... something lovely ... merci :Sign0188: works fine for me Last edited: Sep 29, 2011
hi @warwound good job! opens up new possibilities for WebVie thanks for the sharing ... something lovely ... merci :Sign0188: works fine for me
P petri2000 Member Licensed User Longtime User Sep 30, 2011 #6 I like it... Thanks for sharing will be useful....
peacemaker Expert Licensed User Longtime User Nov 19, 2013 #7 Is it possible now to see this sample when the lib is not published ? UPDATE: aha, new lib has similar methods... UPDATE2: but anyway does not work with the image parameter to .HTM Last edited: Nov 19, 2013
Is it possible now to see this sample when the lib is not published ? UPDATE: aha, new lib has similar methods... UPDATE2: but anyway does not work with the image parameter to .HTM