catchthecows / AndroidImageMap

An HTML map like widget in an Android view
199 stars 74 forks source link

DensityFactor on HighDensity Devices causes error in touch point calculation. #8

Open leeclarke opened 10 years ago

leeclarke commented 10 years ago

When the ImageMap is trying to determine the touch x,y position on the image the DensityFactor causes the textx/texty values to be incorrect. I've tracked the problem to line 1112 & 1113 where the x/y coordinates are scaled for density but, on a Nexus5 or Galaxy4 I see the DensityFactor being set to a value of 3.0 which causes the touch point to be computed to 1/3 the value it should be. Simply not dividing by the densityFactor will fix the problem but, I'm sure that's there for a good reason so taking it out is probably not the answer. :)
I suspect just from looking over the density value in the api docs that this works fine with lower density screens where the factor is <=1 so perhaps all that is required is only to scale if <1? I don't have a device with lower resolution to test on or I would try to test this and put together a patch.