packager icon indicating copy to clipboard operation
packager copied to clipboard

Svg cause black square on mobile Safari

Open binchen1998 opened this issue 2 years ago • 8 comments

Hi,

I am using TurboWarp to convert my project and run on my mobile iOS device. I found that some big svg file will cause black square on screen. However on desktop or android device there is no such bug.

Reproduce:

Convert attached sb3 file to html file and running on iOS safari(for 2018 iPad it can reproduce easily but on newer device it's harder to reproduce, looks like memory size related).

I have tried to work around this issue, and found that if the svg are converted to bitmap in Scratch and then convert to html, the issue is gone.

I can feel that it is a Safari bug but it's strange that before converting to html, the sb3 works fine in Scratch environment. Maybe TurboWarp is using a different svg way than Scratch?

Please take a look, thanks.

打气球 (1).sb3.zip

https://user-images.githubusercontent.com/53246397/160339780-9d4a4c29-9a7b-4463-a39f-1e063d38c184.mp4

binchen1998 avatar Mar 28 '22 06:03 binchen1998

This is very strange, but unfortunately I don't have any iOS devices to test with

If it looks okay after converting to bitmap then I would suggest doing that for now

GarboMuffin avatar Mar 29 '22 19:03 GarboMuffin

Hi,

Thanks for your reply! I finally found the root cause, it is caused by mobile Safari svg memory bug. The description is here:

https://stackoverflow.com/questions/42378266/too-many-svgs-for-mobile-safari

Convert to bitmap can resolve the issue, but as Scratch didn't use the anti alias so the converted bitmap looks very glichy. Can I enable anti alias in TurboWarp?(or called linear interpolation, sorry I am not a CG expert)

Thanks.

binchen1998 avatar Mar 30 '22 02:03 binchen1998

Can you see if it works properly here: https://garbomuffin.github.io/packager/

It's a modified version of the packager that uses the standard Scratch renderer instead of TurboWarp's optimized renderer. I'm curious to find out if that fixes the problem.

GarboMuffin avatar Mar 31 '22 18:03 GarboMuffin

Hi, I made some tests, the problem is gone.

I will try to use this version in my production environment, if there is any problem, I will report to you.

Thanks again.

binchen1998 avatar Apr 01 '22 03:04 binchen1998

It's weird that this version's memory usage is still high(>1G), but there is no black box at all.

binchen1998 avatar Apr 01 '22 03:04 binchen1998

One more thing, does the project work properly when run on https://turbowarp.org/ (not in the packager)?

GarboMuffin avatar Apr 01 '22 04:04 GarboMuffin

One more thing, does the project work properly when run on https://turbowarp.org/ (not in the packager)?

Looks good, no black box appears. This time the memory is good now, no more than 700MB.

binchen1998 avatar Apr 01 '22 04:04 binchen1998

If convenient, can you check if this still happens using https://packager.turbowarp.org/ ?

GarboMuffin avatar Jun 26 '22 07:06 GarboMuffin

ill assume its fixed

GarboMuffin avatar May 23 '24 07:05 GarboMuffin