Closed jerbaroo closed 7 years ago
Reading the documentation I realised the previous behaviour was the intended behaviour.
However exposing some more of the event data to the user would be helpful.
It seems at first, for my use-case, like I could use the previous behaviour and get the coordinates relative to the source element, and then attach the foo
div relative to the source element. However I need to set a high z-index on the foo
div, but in CSS you cannot set a z-index of a child greater than a parent, so I'm attaching the foo
div to the HTML body.
My revised suggestion @HeinrichApfelmus would be to return a data type with multiple fields, from all events, something like:
-- (not all fields covered here)
data EventData = EventData {
ePageX :: Maybe Int
, ePageY :: Maybe Int
, eOffsetX :: Maybe Int
, eOffsetY :: Maybe Int
, eWhich :: Maybe Int
, eValue :: Maybe String
}
To not break the API the existing event functions like mousemove
could extract the relevant field.
I have attached images showing the previous behaviour and the updated behaviour in both Chrome and Electron.
The code used displays a
div
with text "foo" at the coordinates where the right-click took place. In each case the right click actually took place on the "s" of "Proofs".Electron before![electron-err](https://cloud.githubusercontent.com/assets/6631452/23309630/5de7b4da-faa7-11e6-97af-5d1476e2a6ac.png)
Electron after![electron-fix](https://cloud.githubusercontent.com/assets/6631452/23309640/6666cf10-faa7-11e6-89d9-41994b91a352.png)
Chrome before![chrome-err](https://cloud.githubusercontent.com/assets/6631452/23309644/6b87c7b0-faa7-11e6-98f3-7d07ed4d4421.png)
Chrome after![chrome-fix](https://cloud.githubusercontent.com/assets/6631452/23309654/70e24d70-faa7-11e6-8cd2-e8113950eaa3.png)