two.js icon indicating copy to clipboard operation
two.js copied to clipboard

[Bug] Negative scale does not work, with webgl mode only

Open Nicoco220983 opened this issue 1 year ago • 1 comments

Negative scale does not work, with webgl mode only.

To Reproduce

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <script src="build/two.min.js"></script>
  </head>
  <body>
    <script>
        var two = new Two({
            type: Two.Types.webgl,
            fullscreen: true,
            autostart: true
        }).appendTo(document.body)
        const shape = two.makeRectangle(two.width * .5, two.height * .5, 100, 100)
        shape.scale = -.5
    </script>
  </body>
</html>

Expected behavior The rectangle should be visible (it is when desactivating webgl mode)

Desktop (please complete the following information):

  • Browser [firefox]
  • Version [latest: v0.8.13]

Nicoco220983 avatar Apr 11 '24 20:04 Nicoco220983

Ah yes, this is likely because all the objects in WebGL are rendered on one side. I'll look into this.

jonobr1 avatar Apr 12 '24 16:04 jonobr1

Fixed with this PR: https://github.com/jonobr1/two.js/pull/738

jonobr1 avatar Sep 21 '24 04:09 jonobr1