ID:2466837
 
Resolved
When using an <img> tag in maptext, the alignment of the text's baseline to image bottom caused the text to be incorrectly positioned in some cases, causing the text to be culled.
BYOND Version:512
Operating System:Windows 7 Pro 64-bit
Web Browser:Chrome 74.0.3729.131
Applies to:Dream Seeker
Status: Resolved (512.1468)

This issue has been resolved.
Descriptive Problem Summary: When maptext is setup to shown MouseEntered() and hide on MouseExited(), maptext shows incorrectly when an tag is included.

Download this test environment and run a session, use the test verb, then move your mouse over your character a few times while observing.

Expected Results: To see the image properly aligned to the left side of the rest of the maptext.

Actual Results: Very funky results where the img, or the regular maptext (everything but the img tag), but never both, appear on MouseEntered().

Does the problem occur:
Every time? Or how often? All the time.
In other games? All games; successfully reproduced in a test environment.

When does the problem NOT occur? N/A

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

I first discovered this issue in 512.1454 and noticed the same results in 1467.

Workarounds: N/A

Bump? Wassup with this, test case 'n all?
I got sidetracked on a separate issue, but when I just checked out your test project it's actually empty. You need to compile it before packaging the files. Please let me know when you've replaced the file and I'll try again.
In response to Lummox JR
No problem.

I updated the main post with the correct source files.
Okay, I have some preliminary findings:

1) There is a bug in the maptext engine that, when it shifts the text to align its baseline with the image, doesn't count the height of the line properly. This was causing the text to extend past the maptext bounds which currently culls it.

2) There's a delay looking up the image by name, because the current implementation forces the server to look up the name. I've added some code that allows a client-side cache lookup by name, provided there are no name conflicts. (You can avoid this delay in the current build by using \ref around the icon file. That uses the cache ID which is already known, avoiding any lookups.)

3) When the delay happens, the maptext is not redrawn on the next tick if the map has no other activity happening. This is a rather harder problem to solve so I'm going to leave it alone for now.

4) Even after the fix, I have observed that occasionally the text appears on a different line than the image; this is completely intermittent. I believe the malformed HTML is partly to blame; by specifying alignment for the text but not the icon, it's actually changing the alignment from the default left, so in fact the image and text really should always be on separate lines. However the way this changes intermittently is no good no matter which way it goes, so I'm gonna try to figure out what's going on. (An important note: Currently maptext does not support mixed alignment, so I could see why you'd write the HTML that way. In a future version that may not be the case.)
I believe the malformed HTML is partly to blame; by specifying alignment for the text but not the icon

Ah, yeah, good point. That was a result of quickly whipping up the test case. In my actual project, both the image and text are aligned properly, so that part isn't an issue.

[...] by using \ref around the icon file

Though the image does seem to appear without delay, the issue persists.




Thanks for looking into this. I hope it's not too big a problem; I only recently found out about this feature and am looking forward to putting it to work.
Lummox JR resolved issue with message:
When using an <img> tag in maptext, the alignment of the text's baseline to image bottom caused the text to be incorrectly positioned in some cases, causing the text to be culled.