jonobr1 / two.js

A renderer agnostic two-dimensional drawing api for the web.
https://two.js.org
MIT License
8.31k stars 455 forks source link

[Bug] ZUI addLimits should include translations #632

Open jackieveev opened 2 years ago

jackieveev commented 2 years ago

Describe the bug zui.addLimits(0.2, 2, 'scale') works well, but zui.addLimits(0, 1000, 'x') and zui.addLimits(0, 1000, 'y') not working as what I expected.

To Reproduce

var two = new Two({
  fullscreen: true,
  autostart: true,
  type: Two.Types.canvas
})
two.appendTo(document.body)

var zui = new Two.ZUI(stage)

Expected behavior It should be works for the limitation of x and y when zui.translateSurface(dx, dy)

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please select one):

Desktop (please complete the following information):

jonobr1 commented 2 years ago

zui.addLimit is only for scale. There aren't limits / boundaries for panning.