Shirakumo / alloy

A new user interface protocol and toolkit implementation
https://shirakumo.github.io/alloy
zlib License
181 stars 12 forks source link

Plot out of bounds (BUG) #13

Closed Trashtalk217 closed 4 years ago

Trashtalk217 commented 4 years ago

When you have a plot with a specified y-range and data that falls out of that range the visual representation of the plot falls outside of the bounds of the component.

Example

(define-example plot (screen)
  (let* ((window (windowing:make-window screen :min-size (alloy:px-size 300 300)))
         (focus (make-instance 'alloy:focus-list :focus-parent window))
         (layout (make-instance 'alloy:vertical-linear-layout :layout-parent window))
         (button (alloy:represent "Hello" 'alloy:button))
         (parabola (make-array 100 :initial-contents (loop for i from 0 below 100 collect (- (* i i) 10))))
         (plot (alloy:represent parabola
                                'alloy:plot
                                :x-range '(0 . 100)
                                :y-range '(0 . 100))))
    (alloy:enter button layout)
    (alloy:enter plot layout)
    (alloy:enter button focus)
    (alloy:enter plot focus)))

I've been looking if there was a way to do this without altering the code a lot. But I haven't found it yet. I'll keep looking, but for now it's good to have shared it.

Shinmera commented 4 years ago

The component should probably restrict visibility outside itself with with-constrained-visibility.

Trashtalk217 commented 4 years ago

I'll look into it

Trashtalk217 commented 4 years ago

14

I think I've found a fix for the problem.