ID:1699384
 
Resolved
icon-y in mouse coordinates was based on standard icon height, not individual icon height, and therefore didn't work correctly for icons taller or shorter than the default height.
BYOND Version:507
Operating System:Windows 7 Home Premium 64-bit
Web Browser:Firefox 32.0
Applies to:Webclient
Status: Resolved (507.1261)

This issue has been resolved.
Descriptive Problem Summary:
The web client reports pixel_x/y mouse params that are different from those reported by DS, and are consistent but seemingly arbitrary. This happens when an icon is given a weird and large size. Given how weird thumbnails for these icon_states look, I'm guessing that this is actually a problem with how icons are handled internally; a problem that DS can work around but that something in the web client has brought to the surface.

Numbered Steps to Reproduce Problem:
1: Create a .dmi file with several states and a size of 26x130. Notice how the DM icon editor displays the icon_state thumbnail incorrectly: it appears as though the canvas is about twice the size it should be, and the graphic is being squished into the top. This leads me to believe that some aspect of the code is treating the oddly sized graphic as though it were of a different size for convenience.
2: Create a proc to report the exact pixel_x/y params of a click event.
3: Click an atom using that icon. (In my case, a screen object).
4: Note how the reported coordinates differ between the web client and DS by 98px.

Code Snippet (if applicable) to Reproduce Problem:
https://github.com/jacobabrennan/carrot
Note the files:
hud1x5.dmi
player_mouse_control.dm - Lines 64 & 65.

Replace lines 64 and 65 with a diagnostic output of pixel_x/y, and you'll notice differences between the coordinates reported by the web client and DS.

Expected Results:
The same results are reported by both the web client and DS.

Actual Results:
Pixel_x/y params are reported differently depending on what client you are using.

Does the problem occur:
Every time? Or how often?
The problem happens every time a mouse event is fired on a sufficiently large icon using the web client.
In other games?
Have not tested.
In other user accounts?
Yes. KaioChao first brought it to my attention.
On other computers?
Yes. Same as above.

When does the problem NOT occur?
When using smaller icon states.

Workarounds:
if(usr.client.connection == "web")
pixel_y += MAGIC_NUMBER


This is an unmaintainable solution, as it requires a different magic number for each icon.
Lummox JR resolved issue with message:
icon-y in mouse coordinates was based on standard icon height, not individual icon height, and therefore didn't work correctly for icons taller or shorter than the default height.