{"action":"created","issue":{"url":"https://api.github.com/repos/thestonefox/VRTK/issues/1543","repository_url":"https://api.github.com/repos/thestonefox/VRTK","labels_url":"https://api.github.com/repos/thestonefox/VRTK/issues/1543/labels{/name}","comments_url":"https://api.github.com/repos/thestonefox/VRTK/issues/1543/comments","events_url":"https://api.github.com/repos/thestonefox/VRTK/issues/1543/events","html_url":"https://github.com/thestonefox/VRTK/pull/1543","id":263512372,"number":1543,"title":"fix(UIPointer): fix enter and exit events for ui elements","user":{"login":"kristianpd","id":378038,"avatar_url":"https://avatars3.githubusercontent.com/u/378038?v=4","gravatar_id":"","url":"https://api.github.com/users/kristianpd","html_url":"https://github.com/kristianpd","followers_url":"https://api.github.com/users/kristianpd/followers","following_url":"https://api.github.com/users/kristianpd/following{/other_user}","gists_url":"https://api.github.com/users/kristianpd/gists{/gist_id}","starred_url":"https://api.github.com/users/kristianpd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kristianpd/subscriptions","organizations_url":"https://api.github.com/users/kristianpd/orgs","repos_url":"https://api.github.com/users/kristianpd/repos","events_url":"https://api.github.com/users/kristianpd/events{/privacy}","received_events_url":"https://api.github.com/users/kristianpd/received_events","type":"User","site_admin":false},"labels":[{"id":375652932,"url":"https://api.github.com/repos/thestonefox/VRTK/labels/need%20to%20look%20at%20this","name":"need to look at this","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2017-10-06T17:06:12Z","updated_at":"2017-10-28T14:36:42Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/thestonefox/VRTK/pulls/1543","html_url":"https://github.com/thestonefox/VRTK/pull/1543","diff_url":"https://github.com/thestonefox/VRTK/pull/1543.diff","patch_url":"https://github.com/thestonefox/VRTK/pull/1543.patch"},"body":"Fixes #1542 \r\n\r\n## Steps to reproduce\r\n\r\n**First bug (no exit event)**\r\n- Open `034_Controls_InteractingWithUnityUI` example scene\r\n- Using the right controller pointer, hold down the touchpad and hover over keyboard keys\r\n- Open console, look at the event logs coming from `VRTK_ControllerUIPointerEvents_ListenerExample` \r\n- Notice lack of exit events when going from one key to another (you will get one exit on the last key you let go of the button on)\r\n\r\n**Second bug (repetitive enter events)**\r\n- Open `034_Controls_InteractingWithUnityUI` example scene\r\n- Delete all elements except the `Text` element on the `WorldKeyboard` game object (or create a new canvas if you want)\r\n- Center it so it's easy to point at\r\n- Run example, hover over the text field with the right pointer\r\n- Open console, look at the event logs coming from `VRTK_ControllerUIPointerEvents_ListenerExample` \r\n- Notice the repetitive `Enter` events fired for the `Text` element and the (added at runtime) `VRTK_UICANVAS_DRAGGABLE_PANEL`\r\n\r\n**After change**\r\n- Matching `Exit` events for each key as you switch from one element to another\r\n- No repetitive `Enter` events fired, no `VRTK_UICANVAS_DRAGGABLE_PANEL`, just a single `Text` element enter event\r\n\r\n## Details\r\n`UIPointer UIPointerElementExit` was not being fired when you would switch the pointer to another UI element. This makes sure to fire `Exit` before firing a new event.\r\n\r\nThe bug was due to https://github.com/thestonefox/VRTK/pull/1543/files#diff-73ae7845543525150668186d7b88d968L137 finding a new `target` because there were `results` when moving directly from one element to another. \r\n\r\nThis fixes it by checking to see if there was any previous `hoveringElement`, and firing `exit` on it before firing `enter` on the next element. \r\n\r\nhttps://github.com/thestonefox/VRTK/pull/1543/files#diff-73ae7845543525150668186d7b88d968L165\r\nStill handles the case where you move off the edge of the element and don't land on a new one.\r\n\r\nHere's a screenshot of me hovering over QWERTY keys with pointer before and after the fix in the `034_Controls_InteractingWithUnityUI` example scene.\r\n\r\n**before**\r\n![bug](https://user-images.githubusercontent.com/378038/31289547-162d8de0-aa97-11e7-831b-c06389fc6d3b.JPG)\r\n\r\n**after**\r\n![fix](https://user-images.githubusercontent.com/378038/31289553-18873eec-aa97-11e7-8eb9-7601c252a928.JPG)\r\n\r\n\r\nThis PR also fixes a somewhat related issue where `Enter` events were being repetitively fired when hovering over elements that didn't execute their Enter event in their hierarchy. An example of this was a `Text` field on its own, outside of any `Button` or other element's hierarchy. With this change, `Enter` and `Exit` are only fired once each for the text field.\r\n"},"comment":{"url":"https://api.github.com/repos/thestonefox/VRTK/issues/comments/340195731","html_url":"https://github.com/thestonefox/VRTK/pull/1543#issuecomment-340195731","issue_url":"https://api.github.com/repos/thestonefox/VRTK/issues/1543","id":340195731,"user":{"login":"kristianpd","id":378038,"avatar_url":"https://avatars3.githubusercontent.com/u/378038?v=4","gravatar_id":"","url":"https://api.github.com/users/kristianpd","html_url":"https://github.com/kristianpd","followers_url":"https://api.github.com/users/kristianpd/followers","following_url":"https://api.github.com/users/kristianpd/following{/other_user}","gists_url":"https://api.github.com/users/kristianpd/gists{/gist_id}","starred_url":"https://api.github.com/users/kristianpd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kristianpd/subscriptions","organizations_url":"https://api.github.com/users/kristianpd/orgs","repos_url":"https://api.github.com/users/kristianpd/repos","events_url":"https://api.github.com/users/kristianpd/events{/privacy}","received_events_url":"https://api.github.com/users/kristianpd/received_events","type":"User","site_admin":false},"created_at":"2017-10-28T14:36:42Z","updated_at":"2017-10-28T14:36:42Z","author_association":"NONE","body":"ok i'll take a look at updating it this week"}}
{"actor":{"display_login":"kristianpd"}}