ScrollToBox scrolls the layout to ensure that given rect box is in view. Returns true if scrolling was needed
(box image.Rectangle)
| 384 | // ScrollToBox scrolls the layout to ensure that given rect box is in view. |
| 385 | // Returns true if scrolling was needed |
| 386 | func (fr *Frame) ScrollToBox(box image.Rectangle) bool { |
| 387 | did := false |
| 388 | if fr.HasScroll[math32.Y] && fr.HasScroll[math32.X] { |
| 389 | did = fr.scrollToBoxDim(math32.Y, box.Min.Y, box.Max.Y) |
| 390 | did = did || fr.scrollToBoxDim(math32.X, box.Min.X, box.Max.X) |
| 391 | } else if fr.HasScroll[math32.Y] { |
| 392 | did = fr.scrollToBoxDim(math32.Y, box.Min.Y, box.Max.Y) |
| 393 | } else if fr.HasScroll[math32.X] { |
| 394 | did = fr.scrollToBoxDim(math32.X, box.Min.X, box.Max.X) |
| 395 | } |
| 396 | if did { |
| 397 | fr.NeedsRender() |
| 398 | } |
| 399 | return did |
| 400 | } |
| 401 | |
| 402 | // ScrollDimToStart scrolls to put the given child coordinate position (eg., |
| 403 | // top / left of a view box) at the start (top / left) of our scroll area, to |
no test coverage detected