• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Find location of touch on image in view

 
Rancher
Posts: 4936
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 4936
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 4936
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic