automat / controlkit.js

A lightweight controller and gui library
823 stars 82 forks source link

svg size in ValuePlotter doesn't be update on resize. #11

Closed 2bbb closed 8 years ago

2bbb commented 8 years ago

hi. thanks for good library!

i found bug(?) in ValuePlotter. (and maybe other Plotter. but i don't check now.)

after call panel.getNode().setWidth(new_size), and ValuePlotter::onGroupSizeChange is called. but, drawing area doesn't be change. and it will change after i disable and enable panel, group, or subgroup with click button.

i think, doesn't it call some update or similar method? but, sorry, i couldn't find cause of problem.

best regards.

automat commented 8 years ago

Hi, thanks. Please provide an example.

Do you change the panel size externally via panel.getNode().setWidth(value)? If so, thats a new use-case as panel/components-size are meant to be static after init, eg.:

new ControlKit().addPanel({width:300}); //panel size set, never changes for that specific panel

If you need to change panel size after init, can you describe a scenario where this would be useful.

2bbb commented 8 years ago

thanks for comment.

okay, i understand why Components don't have setWidth/setHeight method ;)

i want to use in resizable window, and want to keep propotion of width when resized. like below code.

            window.addEventListener('resize', function() {
                left_panel.getNode().setWidth(window.innerWidth * 0.5);
                right_panel.getNode().setWidth(window.innerWidth * 0.5);
            });

ofcourse, if this library is supposed to using in static size, i will follow concept.

thanks.

automat commented 8 years ago

Ok, get it, putting it on my list of possible enhancements.

2bbb commented 8 years ago

very thanks!!

and can i ask a other question? does ValuePlotter assumes value range is in [-1, 1]?

automat commented 8 years ago

Please open another issue, thanks.

2bbb commented 8 years ago

i open another issue. sorry!