Phaser transform dom breaks css borders

Hi, im using phaser dom for game ui. and to be precise im using div and set in css border image to achieve the effect of pixel art borders with functionality to resize div no matter how big content is inside., this is extremely handy, especially in speech ballons.

But each time i add border image, borders will break and leave gap like in image.

image

I tried to reproduce this bug outside of phaser using html and css but not matter what i did i couldnt create the same problem, but i found that this happens because phaser are using css matrix() to scale dom and update it constantly.

Does anyone have solution for this or maybe some alternative what i can use

Maybe pad the CSS images.

1 Like

I couldn’t find any info about this on internet so i think this is phaser problem because in each loop it updates the position of dom and css just cant fast enough calc all info, because when i turn off update everything is okay.

In case that someone needs this in the future this are the options.

  1. use phaser render and not use dom at all.
  2. use css images as samme mention, like background image that is static, but you will lose freedom to resize everything dynamicly so you will need to prepare more sizes (same would be in render).
  3. use before and after to place image top and bottom, but widht must remain always the same.
  4. add css 8 images (bottom border, top border, left border,right border and 4 corners) in the div and place them with absolute position around the div.
  5. use multiple background images in the same div to simulate border but you will not be able to create corners.

maybe using image-rendering:pixelated; css rule on dom element will fix issue

I advice achieving same kind of decorated & responsive containers using nineslice technique.
there’s plugin for Phaser for achieving it