/** * creates a rippler for the specified control, mask and position. * * @param control * @param mask can be either rectangle/cricle * @param pos can be either FRONT/BACK (position the ripple effect infront of or behind the control) */ public JFXRippler(Node control, RipplerMask mask, RipplerPos pos) { initialize(); setMaskType(mask); setPosition(pos); createRippleUI(); setControl(control); // listen to control position changed position.addListener(observable -> updateControlPosition()); setPickOnBounds(false); setCache(true); setCacheHint(CacheHint.SPEED); setCacheShape(true); }
@Override protected void starting() { super.starting(); if (node.getParent() instanceof JFXRippler) { JFXRippler rippler = (JFXRippler) node.getParent(); BorderPane p = new BorderPane(node); p.setMaxWidth(((JFXHamburger) node).getWidth()); p.setMinWidth(((JFXHamburger) node).getWidth()); p.addEventHandler(MouseEvent.ANY, (event) -> { if (!event.isConsumed()) { event.consume(); node.fireEvent(event); } }); rippler.setControl(p); } if (this.getRate() == -1) { ((JFXHamburger) node).getChildren().get(1).setVisible(true); } }
/** * creates a rippler for the specified control, mask and position. * * @param control * @param mask can be either rectangle/cricle * @param pos can be either FRONT/BACK (position the ripple effect infront of or behind the control) */ public JFXRippler(Node control, RipplerMask mask, RipplerPos pos) { initialize(); setMaskType(mask); setPosition(pos); createRippleUI(); setControl(control); // listen to control position changed position.addListener(observable -> updateControlPosition()); setPickOnBounds(false); setCache(true); setCacheHint(CacheHint.SPEED); setCacheShape(true); }
@Override protected void starting() { super.starting(); if (node.getParent() instanceof JFXRippler) { JFXRippler rippler = (JFXRippler) node.getParent(); BorderPane p = new BorderPane(node); p.setMaxWidth(((JFXHamburger) node).getWidth()); p.setMinWidth(((JFXHamburger) node).getWidth()); p.addEventHandler(MouseEvent.ANY, (event) -> { if (!event.isConsumed()) { event.consume(); node.fireEvent(event); } }); rippler.setControl(p); } if (this.getRate() == -1) { ((JFXHamburger) node).getChildren().get(1).setVisible(true); } }