use of javafx.scene.shape.Rectangle in project FXyzLib by Birdasaur.
the class CubeWorld method buildPanels.
private void buildPanels(double size) {
// @SMP TODO might be easier to just replace the Rectangle side panels with really flat Box 3D objects
x1AxisRectangle = new Rectangle(size, size, panelWallColor);
x2AxisRectangle = new Rectangle(size, size, panelWallColor);
y1AxisRectangle = new Rectangle(size, size, panelWallColor);
y2AxisRectangle = new Rectangle(size, size, panelWallColor);
z1AxisRectangle = new Rectangle(size, size, panelFloorColor);
z2AxisRectangle = new Rectangle(size, size, panelCeilingColor);
x1AxisRectangle.setTranslateX(-size / 2);
x1AxisRectangle.setTranslateY(-size / 2);
x1AxisRectangle.setTranslateZ(-size / 2);
x2AxisRectangle.setTranslateX(-size / 2);
x2AxisRectangle.setTranslateY(-size / 2);
x2AxisRectangle.setTranslateZ(size / 2);
getChildren().addAll(x1AxisRectangle, x2AxisRectangle);
y2AxisRectangle.setTranslateY(-size / 2);
y2AxisRectangle.setRotationAxis(Rotate.Y_AXIS);
y2AxisRectangle.setRotate(89.9);
y1AxisRectangle.setTranslateX(-size);
y1AxisRectangle.setTranslateY(-size / 2);
y1AxisRectangle.setRotationAxis(Rotate.Y_AXIS);
y1AxisRectangle.setRotate(89.9);
getChildren().addAll(y1AxisRectangle, y2AxisRectangle);
z1AxisRectangle.setTranslateX(-size / 2);
z1AxisRectangle.setRotationAxis(Rotate.X_AXIS);
z1AxisRectangle.setRotate(89.9);
z2AxisRectangle.setTranslateX(-size / 2);
z2AxisRectangle.setTranslateY(-size);
z2AxisRectangle.setRotationAxis(Rotate.X_AXIS);
z2AxisRectangle.setRotate(89.9);
getChildren().addAll(z1AxisRectangle, z2AxisRectangle);
}
use of javafx.scene.shape.Rectangle in project FXyzLib by Birdasaur.
the class CubeViewer method buildPanels.
private void buildPanels(double size) {
// @SMP TODO might be easier to just replace the Rectangle side panels with really flat Box 3D objects
x1AxisRectangle = new Rectangle(size, size, x1AxisRectangleColor);
x2AxisRectangle = new Rectangle(size, size, x2AxisRectangleColor);
y1AxisRectangle = new Rectangle(size, size, y1AxisRectangleColor);
y2AxisRectangle = new Rectangle(size, size, y2AxisRectangleColor);
z1AxisRectangle = new Rectangle(size, size, z1AxisRectangleColor);
z2AxisRectangle = new Rectangle(size, size, z2AxisRectangleColor);
x1AxisRectangle.setTranslateX(-size / 2);
x1AxisRectangle.setTranslateY(-size / 2);
x1AxisRectangle.setTranslateZ(-size / 2);
x2AxisRectangle.setTranslateX(-size / 2);
x2AxisRectangle.setTranslateY(-size / 2);
x2AxisRectangle.setTranslateZ(size / 2);
getChildren().addAll(x1AxisRectangle, x2AxisRectangle);
y2AxisRectangle.setTranslateY(-size / 2);
y2AxisRectangle.setRotationAxis(Rotate.Y_AXIS);
y2AxisRectangle.setRotate(89.9);
y1AxisRectangle.setTranslateX(-size);
y1AxisRectangle.setTranslateY(-size / 2);
y1AxisRectangle.setRotationAxis(Rotate.Y_AXIS);
y1AxisRectangle.setRotate(89.9);
getChildren().addAll(y1AxisRectangle, y2AxisRectangle);
z1AxisRectangle.setTranslateX(-size / 2);
z1AxisRectangle.setRotationAxis(Rotate.X_AXIS);
z1AxisRectangle.setRotate(89.9);
z2AxisRectangle.setTranslateX(-size / 2);
z2AxisRectangle.setTranslateY(-size);
z2AxisRectangle.setRotationAxis(Rotate.X_AXIS);
z2AxisRectangle.setRotate(89.9);
getChildren().addAll(z1AxisRectangle, z2AxisRectangle);
}
use of javafx.scene.shape.Rectangle in project FXyzLib by Birdasaur.
the class Patterns method createPattern.
public Image createPattern(CarbonPatterns cp, boolean save) {
ImagePattern pattern;
switch(cp) {
case DARK_CARBON:
pattern = createCarbonPattern();
break;
case LIGHT_CARBON:
pattern = createLightCarbonPattern();
break;
case CARBON_KEVLAR:
pattern = createCarbonKevlarPattern();
break;
default:
pattern = createCarbonPattern();
break;
}
Rectangle rectangle = new Rectangle(width, height);
if (pattern != null) {
rectangle.setFill(pattern);
}
rectangle.setStrokeWidth(0);
imgPattern = rectangle.snapshot(new SnapshotParameters(), null);
if (save) {
saveImage();
}
return imgPattern;
}
use of javafx.scene.shape.Rectangle in project JFoenix by jfoenixadmin.
the class JFXTabPaneSkin method addTabContentHolder.
private void addTabContentHolder(Tab tab) {
// create new content place holder
TabContentHolder tabContentHolder = new TabContentHolder(tab);
tabContentHolder.setClip(new Rectangle());
tabContentHolders.add(tabContentHolder);
// always add tab content holder below its header
tabsContainer.getChildren().add(0, tabContentHolder);
}
use of javafx.scene.shape.Rectangle in project JFoenix by jfoenixadmin.
the class JFXTabPaneSkin method layoutChildren.
@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
final double headerHeight = snapSize(header.prefHeight(-1));
final Side side = getSkinnable().getSide();
double tabsX = side == Side.RIGHT ? x + w - headerHeight : x;
double tabsY = side == Side.BOTTOM ? y + h - headerHeight : y;
final int rotation = getRotation(side);
// update header
switch(side) {
case TOP:
header.resize(w, headerHeight);
header.relocate(tabsX, tabsY);
break;
case LEFT:
header.resize(h, headerHeight);
header.relocate(tabsX + headerHeight, h - headerHeight);
break;
case RIGHT:
header.resize(h, headerHeight);
header.relocate(tabsX, y - headerHeight);
break;
case BOTTOM:
header.resize(w, headerHeight);
header.relocate(w, tabsY - headerHeight);
break;
}
header.getTransforms().setAll(new Rotate(rotation, 0, headerHeight, 1));
// update header clip
// header.clip.setX(0);
// header.clip.setY(0);
// header.clip.setWidth(isHorizontal() ? w : h);
// header.clip.setHeight(headerHeight + 10); // 10 is the height of the shadow effect
// position the tab content of the current selected tab
double contentStartX = x + (side == Side.LEFT ? headerHeight : 0);
double contentStartY = y + (side == Side.TOP ? headerHeight : 0);
double contentWidth = w - (isHorizontal() ? 0 : headerHeight);
double contentHeight = h - (isHorizontal() ? headerHeight : 0);
// update tabs container
tabsClip.setWidth(contentWidth);
tabsClip.setHeight(contentHeight);
tabsContainerHolder.resize(contentWidth, contentHeight);
tabsContainerHolder.relocate(contentStartX, contentStartY);
tabsContainer.resize(contentWidth * tabContentHolders.size(), contentHeight);
for (int i = 0, max = tabContentHolders.size(); i < max; i++) {
TabContentHolder tabContentHolder = tabContentHolders.get(i);
tabContentHolder.setVisible(true);
tabContentHolder.setTranslateX(contentWidth * i);
if (tabContentHolder.getClip() != null) {
((Rectangle) tabContentHolder.getClip()).setWidth(contentWidth);
((Rectangle) tabContentHolder.getClip()).setHeight(contentHeight);
}
if (tabContentHolder.tab == selectedTab) {
int index = getSkinnable().getTabs().indexOf(selectedTab);
if (index != i) {
tabsContainer.setTranslateX(-contentWidth * i);
diffTabsIndices = i - index;
} else {
// fix X translation after changing the tabs
if (diffTabsIndices != 0) {
tabsContainer.setTranslateX(tabsContainer.getTranslateX() + contentWidth * diffTabsIndices);
diffTabsIndices = 0;
}
// animate upon tab selection only otherwise just translate the selected tab
if (isSelectingTab && !((JFXTabPane) getSkinnable()).isDisableAnimation()) {
new CachedTransition(tabsContainer, new Timeline(new KeyFrame(Duration.millis(1000), new KeyValue(tabsContainer.translateXProperty(), -contentWidth * index, Interpolator.EASE_BOTH)))) {
{
setCycleDuration(Duration.seconds(0.320));
setDelay(Duration.seconds(0));
}
}.play();
} else {
tabsContainer.setTranslateX(-contentWidth * index);
}
}
}
tabContentHolder.resize(contentWidth, contentHeight);
// tabContentHolder.relocate(contentStartX, contentStartY);
}
}
Aggregations