StageXL icon indicating copy to clipboard operation
StageXL copied to clipboard

Bug in Scale9Bitmap ?

Open darting opened this issue 11 years ago • 6 comments
trafficstars

if I build to javascript and visit on ipad(or iphone), will display a line in the bitmap.

is this a bug?

below is the sample:

html file

https://gist.github.com/darting/f5e47067e2754daa9c1e

dart file

https://gist.github.com/darting/40fd0c3b03cf1de072d4

button image

btn_yellow_off

display in ipad

img

darting avatar May 27 '14 05:05 darting

Looks like a bug :) I will take a look at it!

bp74 avatar May 27 '14 05:05 bp74

Are those "retina" iDevices? I've tried it on an old iPhone 4 and on a hi-dpi Android device and it works fine. Must be something with hi-dpi implementation of those iDevices.

Could you try to add this right at the start of your program - just to see the difference:

Stage.autoHiDpi = false;

bp74 avatar May 27 '14 05:05 bp74

I have tried it on iPhone4, if you zoomed in screen use two fingers, also can see this problem. BTW: i have set the autoHiDpi = false

darting avatar May 27 '14 06:05 darting

Hi, do you find it in your device? or any other thing can I help you?

darting avatar May 29 '14 03:05 darting

Hi,

Yes i have tried it and i can see it too. I looks like if Safari doesn't correctly align the coordinates of those scale9 tiles. I have tested it on Android too (Chrome and Firefox) and it works fine. I have also checked the math of the Scale9Bitmap and it looks correct. So we would need a workaround for Safari. We could draw the inner tiles a little bit bigger to avoid the gap, but this way you would get and overlapping effect when you apply an alpha <1 to the Scale9Bitmap. It would work to add some logic to round the coordinates before drawing the textures, but we haven't done this anywhere else in the library so i'm not very happy with it.

A little off topic and it does not solve the problem, but maybe you should add this to your html. Since you want a full screen canvas you probably want to disable zoom pinch:

<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">

bp74 avatar May 29 '14 06:05 bp74

okay, thanks very much.

darting avatar May 29 '14 07:05 darting