{"action":"closed","issue":{"url":"https://api.github.com/repos/mapsplugin/cordova-plugin-googlemaps/issues/815","labels_url":"https://api.github.com/repos/mapsplugin/cordova-plugin-googlemaps/issues/815/labels{/name}","comments_url":"https://api.github.com/repos/mapsplugin/cordova-plugin-googlemaps/issues/815/comments","events_url":"https://api.github.com/repos/mapsplugin/cordova-plugin-googlemaps/issues/815/events","html_url":"https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/815","id":127574553,"number":815,"title":"Need a better way to handle interactions with overlay html elements","user":{"login":"iori57","id":5056279,"avatar_url":"https://avatars.githubusercontent.com/u/5056279?v=3","gravatar_id":"","url":"https://api.github.com/users/iori57","html_url":"https://github.com/iori57","followers_url":"https://api.github.com/users/iori57/followers","following_url":"https://api.github.com/users/iori57/following{/other_user}","gists_url":"https://api.github.com/users/iori57/gists{/gist_id}","starred_url":"https://api.github.com/users/iori57/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iori57/subscriptions","organizations_url":"https://api.github.com/users/iori57/orgs","repos_url":"https://api.github.com/users/iori57/repos","events_url":"https://api.github.com/users/iori57/events{/privacy}","received_events_url":"https://api.github.com/users/iori57/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-20T00:37:45Z","updated_at":"2016-01-26T21:06:25Z","closed_at":"2016-01-26T21:06:25Z","body":"I believe there is a better way to handle overlay html elements than the current way of calling setClickable(false) every time you want to interact with them. As discussed before in https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/590 and many times before.\r\n\r\nThis is because now the plugin puts the native map at the bottom of the screen and the rest of the webview is on top, if we put some buttons that is always there (unlike slide out menu panels) we wouldn't know when to call setClickable(false) because the button should always be usable.\r\n\r\nActually I did some POC on Android using another approach and it seems to work with some caveat:\r\n1) Instead of using the rectangle region of the native map as touchable area, during the touch event I convert the cordova web view to an image, then using the touched coordinate, return me the color of the pixel. Then I check whether the pixel is totally transparent and if so pass the touch event to native map.\r\n2) For any non-transparent pixels (alpha > 0) I assume that we are touching an html element and ignores it so that the html element can register that touch\r\n3) It seems to work, anything that is on top of the map can now be interacted. But.. I'm afraid that the performance impact would be huge because I'm converting the view to an image every single time we touch the screen\r\n\r\nI'm sure there is a more cost efficient way in Android to detect pixel color in a view, if we can find it we can solve this problem once and for all.\r\n\r\nOn iOS I can already do this by subclassing cordova webview and overriding the hitTest function to do the same thing and it works. I used this example here to detect transparent pixel and it seems to work without much performance impact: https://github.com/sSegev/SSAlphaPass\r\n\r\nNow if only we can find a way for Android.. \r\n\r\nPlease let me know what you think. I just think that relying on setClickable is not a good way moving forward.\r\n\r\n"}}