Two ways scroll box?

Here’s another idea (that worked for me):

For mouse dragging:

  • nest two canvases and shift one in the other
  • the top one is the size of the interactable area, the inner one is much larger than the screen - you’d be shifting this one about, it will house all the icons and whatnot
  • *OnMouseDown *captures the attention of the top canvas
  • OnMouseMove shifts the inner canvas by CursorDelta

For scrolling bars:

  • from my experience, h/v scrollboxes will most likely give you a headache after a while - kind of depends of what you want to achieve, though
  • use two slider widgets (placed on the top canvas) for this and map-range them to translate into the size of the inner canvas, overriding their *OnValueChanged *and setting the inner canvas’ slot’s position
  • you’d want to synchronise the mouse drag and the the sliders so the sliders follow it

Let me know if you have any issues setting it up, I can try to dig it up from one of the old projects. I had the whole thing working without any snags.

For zooming in and out:

  • wrap the inner canvas with a ScaleBox and adjust the UserSpecified stretch - this should work in theory, untested.
3 Likes