I’m running the latest release and have found that the call to mte.screenPosToLevelPos sometimes returns the wrong result.
I’ve reproduced this multiple times though the code path is essentially the same:
Load a map
Add an image to the stage (e.g. not to the map)
Add an event handler to the image and then call this inside the event:
local mte = getMTE() logger:log('self', ('self x %d self.y % d'):format(self.x, self.y)) local pos = mte.convert('screenPosToLevelPos', self.x, self.y) logger:log('ScreenPosToLevelPos Result', ("pos x %d pos y %d minY %d maxY %d"):format( pos.x, pos.y, minY, maxY))
Now click on the image and drag slowly (up or down)
Here’s the result: [self x is what the event supplied]
48:39 ScreenPosToLevelPos Result pos x 348 pos y 289
48:39 self self x 348 self.y 288
48:39 ScreenPosToLevelPos Result pos x 348 pos y 256
48:39 self self x 347 self.y 288
48:39 ScreenPosToLevelPos Result pos x 347 pos y 256
48:39 self self x 347 self.y 287
48:39 ScreenPosToLevelPos Result pos x 347 pos y 287
48:40 self self x 347 self.y 287
Notice the two pos Y @ 256. That is not what the event supplied and the call to convert quickly fixes itself. The delta ~= 32 which is my block size. Feels like a rounding error of some sort. Unfortunately it produces a jump where the dragged image quickly skips back and forth.