• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Find location of touch on image in view

 
Master Rancher
Posts: 3876
35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an WebView that loads a jpg image from a simple HTTP server on my PC.  The image is a screen capture of a section of the screen.
The WebView component loads and displays the image without any problem.  If I press on the shown image I get the x,y of the location of the press on the view.  SO far so good.  If I zoom in by outward pinches, the image is enlarged and now the x,y of the view is not the same as the x,y on the image.
If I had the size of the enlarged image and the x,y location of the view on the image, I could compute the x,y of the touch on the image.
There is the problem:  How to get the location of the view on the expanded image and the size of the expanded image?

Also posted Here:  https://stackoverflow.com/questions/61761544/find-location-of-touch-on-image-in-view
 
Norm Radder
Master Rancher
Posts: 3876
35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since most of you like to see code with questions and in a hope of getting a response to this question, here is what I have so far.   It works if the image size is adjusted to be the same size asthe view shown in the tablet.
 
Norm Radder
Master Rancher
Posts: 3876
35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the PC code that communicates with the Android.  It has a lot of Q&D code for testing and debugging.   A lot was Cut and Pasted from other programs so its a bit messy.  Currently mostly working.
 
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic