Commit f1ba7270 authored by Denis Kuplyakov's avatar Denis Kuplyakov
Browse files

Fixed grid layout bias

Changed Grid to Item with absolute positioning of children to prevent
bias of cells from cells drawed at SVG image.
parent 5bf92309
......@@ -76,27 +76,38 @@ Item {
spriteKey: "board_numbers"
}
Grid {
z: 1
Item {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
x: Globals.GRID_OFFSET_X_PERCENT * container.width
y: Globals.GRID_OFFSET_Y_PERCENT * container.height
width: Globals.GRID_WIDTH_PERCENT * container.width
height: Globals.GRID_HEIGHT_PERCENT * container.height
rows: Globals.ROW_COUNT
columns: Globals.COLUMN_COUNT
Repeater {
id: cells
model: Globals.ROW_COUNT * Globals.COLUMN_COUNT
Cell {
width: Globals.GRID_WIDTH_PERCENT * container.width / Globals.COLUMN_COUNT
height: Globals.GRID_HEIGHT_PERCENT * container.height / Globals.ROW_COUNT
x: (index % Globals.COLUMN_COUNT)
* Globals.GRID_WIDTH_PERCENT
* container.width
/ Globals.COLUMN_COUNT;
y: Math.floor(index / Globals.COLUMN_COUNT)
* Globals.GRID_HEIGHT_PERCENT
* container.height
/ Globals.ROW_COUNT;
width: Globals.GRID_WIDTH_PERCENT * container.width
/ Globals.COLUMN_COUNT
height: Globals.GRID_HEIGHT_PERCENT * container.height
/ Globals.ROW_COUNT
onClicked: container.cellClicked(index / Globals.COLUMN_COUNT,
index % Globals.COLUMN_COUNT)
}
}
}
}
......@@ -65,7 +65,7 @@ Item {
Rectangle {
id: cell_last_move_marker;
z: 1
visible: true
visible: false
anchors.fill: parent
color: "#AAAAAA"
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment