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

[Bug] ZUI addLimits should include translations

Open jackieveev opened this issue 3 years ago • 1 comments

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):

  • [x] Code executes in browser (e.g: using script tag to load library)
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/two.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/extras/js/zui.js"></script>

Desktop (please complete the following information):

  • Browser [chrome]

jackieveev avatar May 12 '22 06:05 jackieveev

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

jonobr1 avatar May 16 '22 16:05 jonobr1