Rectangle nodes in Tile layout get wrapped incorrectly for certain values of Rectangles' strokeWidth, width and height.
Code:
def columns = 3;
def strokeWidth = 2;
def size = 20;
Stage {width: 250, height: 250
var scene: Scene;
scene: scene = Scene {
content: VBox {nodeHPos: HPos.CENTER
content: [
Tile {
columns: columns
content:
for (row in [0..<columns * columns])
Rectangle {width: size, height: size,
stroke: RED, strokeWidth: strokeWidth
}
}
Button {text: "B"}
]
}
}
}
Note that the Button is placed correctly as if the Rectangles were in a 3 by 3 matrix, i.e. centered
Changing either columns to 2 or 5, or strokeWidth to 1 or size to 10 gives correct appearance. (Except that there is a weird 2 pixel gap right of the 2nd column and below the 2nd row...:)
Moreover, why are there a default 1 pixel gaps when the Rectangles have a stroke when there is no gap when their stroke is null???
Also: Please make the documentation about Tile.fx more clear: when you talk about "tile", it's not clear if the layout Tile is meant or the content node "tile" - it seems to be used in both ways: Tile (=layout) can be configured to lay out the tiles (=content node)... and: To establish the tile's (which one?) initial preferred size... Suggestion: tile => tile layout or Tile; the tile contained => content node.
Code:
def columns = 3;
def strokeWidth = 2;
def size = 20;
Stage {width: 250, height: 250
var scene: Scene;
scene: scene = Scene {
content: VBox {nodeHPos: HPos.CENTER
content: [
Tile {
columns: columns
content:
for (row in [0..<columns * columns])
Rectangle {width: size, height: size,
stroke: RED, strokeWidth: strokeWidth
}
}
Button {text: "B"}
]
}
}
}
Note that the Button is placed correctly as if the Rectangles were in a 3 by 3 matrix, i.e. centered
Changing either columns to 2 or 5, or strokeWidth to 1 or size to 10 gives correct appearance. (Except that there is a weird 2 pixel gap right of the 2nd column and below the 2nd row...:)
Moreover, why are there a default 1 pixel gaps when the Rectangles have a stroke when there is no gap when their stroke is null???
Also: Please make the documentation about Tile.fx more clear: when you talk about "tile", it's not clear if the layout Tile is meant or the content node "tile" - it seems to be used in both ways: Tile (=layout) can be configured to lay out the tiles (=content node)... and: To establish the tile's (which one?) initial preferred size... Suggestion: tile => tile layout or Tile; the tile contained => content node.