css - JavaFX 2.2 - How to adapt scrolling after zooming inside scrollPane? -
i'm working on application made javafx , css. have reached point have display picture inside scrollpane (which inside gridpane). need zoom picture. succeeded use multi-touch features of trackpad intended.
but when zooming in, scrolling bars aren't showing or stays way @ loading. (the bars displayed (or not) depending of size of picture.)
the same thing happens when zooming out.
pictures talk themselves.
can notice here, vertical scroll bar displayed because pic long.
scroll bars aren't showing. except vertical 1 same state.
you can see when zooming out, that's same thing.
so. how can set bars fit zooming? want able "move" picture trackpad. (the scrollbars running multi-touch gestures , works.)
here's part of code:
tab newtab = new tab(file.getname()); newtab.setclosable(true); // create imageview of picture imageview imageview = new imageview(); // add imageview tab scrollpane = new scrollpane(); /* * zoom */ zoomproperty = new simpledoubleproperty(200); zoomproperty.addlistener(new invalidationlistener() { @override public void invalidated(observable arg0) { imageview.setfitwidth(zoomproperty.get() * 4); imageview.setfitheight(zoomproperty.get() * 3); } }); scrollpane.setonzoom(new eventhandler<zoomevent>() { @override public void handle(zoomevent event) { imageview.setscalex(imageview.getscalex() * event.getzoomfactor()); imageview.setscaley(imageview.getscaley() * event.getzoomfactor()); event.consume(); } }); scrollpane.setonzoomfinished(new eventhandler<zoomevent>() { @override public void handle(zoomevent event) { // want add here don't know what. event.consume(); } }); /* * end zoom */ imageview.setimage(new image(file.touri().tostring())); imageview.preserveratioproperty().set(true); scrollpane.setcontent(imageview); newtab.setcontent(scrollpane); tabview.addtab(newtab); } thank much. don't hesitate ask confirmation or other infos if forgot some.
i realized wasn't using imageview.setfitwidth() resize imageview depending on bounds have instant. scrollpane adapting itself. works now, zooming far worst.
Comments
Post a Comment