• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Find location of touch on image in view

 
Rancher
Posts: 5008
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: 5008
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: 5008
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.
 
Why should I lose weight? They make bigger overalls. And they sure don't make overalls for tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic