{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/8234","repository_url":"https://api.github.com/repos/mapbox/mapbox-gl-js","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/8234/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/8234/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/8234/events","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/8234","id":442202615,"node_id":"MDU6SXNzdWU0NDIyMDI2MTU=","number":8234,"title":"Avoiding mouse events with opacity 0","user":{"login":"mklopets","id":3150328,"node_id":"MDQ6VXNlcjMxNTAzMjg=","avatar_url":"https://avatars0.githubusercontent.com/u/3150328?v=4","gravatar_id":"","url":"https://api.github.com/users/mklopets","html_url":"https://github.com/mklopets","followers_url":"https://api.github.com/users/mklopets/followers","following_url":"https://api.github.com/users/mklopets/following{/other_user}","gists_url":"https://api.github.com/users/mklopets/gists{/gist_id}","starred_url":"https://api.github.com/users/mklopets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mklopets/subscriptions","organizations_url":"https://api.github.com/users/mklopets/orgs","repos_url":"https://api.github.com/users/mklopets/repos","events_url":"https://api.github.com/users/mklopets/events{/privacy}","received_events_url":"https://api.github.com/users/mklopets/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2019-05-09T12:07:47Z","updated_at":"2019-05-10T19:54:20Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"**mapbox-gl-js version**: 0.54.0\r\n\r\n### Question\r\nWhat's the best way to disable touch events on a symbol's text-field once it's faded out? Not sure if this is a bug report, feature request or just a plain ol' question 😄 \r\n\r\n#### Situation:\r\nYou have a symbol with a text-field. You want to hide the text-field when you're zoomed out past some level.\r\n\r\nSo you use an exponential function on the `text-opacity` paint property:\r\n```\r\n'text-opacity': { type: 'exponential', stops: [[5,0], [6,1]] }\r\n```\r\nNow it fades out when moving from zoom level 6->5. Awesome.\r\n\r\nNow you decide to do something on `mouseenter` of the symbol, e.g show a popup. When the label's visible, all is good – `mouseenter` fires when hovering both the icon and the text.\r\n\r\nHowever, when you zoom out past level 5 and the label is invisible, hovering the space it once used to occupy still triggers the `mouseenter` event.\r\n\r\n#### Possible solutions\r\n- work around the issue by setting the `text-field` layout property to empty string based on zoom:\r\n```\r\n'text-field': { type: 'interval', stops: [[0, ''], [5, 'your label here']] }`\r\n```\r\n- mapbox-gl-js stops registering mouse events on anything with opacity = 0\r\n- mapbox-gl-js adds \"visibility\" boolean properties to text, icon etc, which can then use an interval function\r\n"},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/comments/491411106","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/8234#issuecomment-491411106","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/8234","id":491411106,"node_id":"MDEyOklzc3VlQ29tbWVudDQ5MTQxMTEwNg==","user":{"login":"peterqliu","id":4551508,"node_id":"MDQ6VXNlcjQ1NTE1MDg=","avatar_url":"https://avatars2.githubusercontent.com/u/4551508?v=4","gravatar_id":"","url":"https://api.github.com/users/peterqliu","html_url":"https://github.com/peterqliu","followers_url":"https://api.github.com/users/peterqliu/followers","following_url":"https://api.github.com/users/peterqliu/following{/other_user}","gists_url":"https://api.github.com/users/peterqliu/gists{/gist_id}","starred_url":"https://api.github.com/users/peterqliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterqliu/subscriptions","organizations_url":"https://api.github.com/users/peterqliu/orgs","repos_url":"https://api.github.com/users/peterqliu/repos","events_url":"https://api.github.com/users/peterqliu/events{/privacy}","received_events_url":"https://api.github.com/users/peterqliu/received_events","type":"User","site_admin":false},"created_at":"2019-05-10T19:54:20Z","updated_at":"2019-05-10T19:54:20Z","author_association":"CONTRIBUTOR","body":">Is there a way to tell based on the event if it was fired on an icon-image or text-field\r\n\r\nNo, unless they're on separate symbol layers"}}
{"actor":{"display_login":"peterqliu"}}