From 897268c771b3ab39944761666b8511f0a69baf4b Mon Sep 17 00:00:00 2001 From: MetroWind Date: Sun, 31 Aug 2025 17:11:55 -0700 Subject: Add all rooms. (Except for internal wall. Need to figure out how they work.) --- scripts/main.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'scripts/main.js') diff --git a/scripts/main.js b/scripts/main.js index 5483adf..8df176b 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -37,18 +37,23 @@ function genGrid(x_count, y_count, cell_size) function AssetView({asset_index, on_drag_begin, on_drag_end}) { + let bg = ASSET_WHITE_BG; + if(TILES[asset_index].bg === null) + { + bg = null; + } return h("div", {"class": "Asset", "draggable": true, "data-asset-index": asset_index, "ondragstart": on_drag_begin, - "ondragend": on_drag_end,}, - h("svg", ASSET_SVG_PROPS, ASSET_WHITE_BG, - TILES[asset_index].inner_svg)); + "ondragend": on_drag_end, + "title": TILES[asset_index].name,}, + h("svg", ASSET_SVG_PROPS, bg, TILES[asset_index].inner_svg)); } function AssetsView({on_drag_begin, on_drag_end}) { - let views = TILES.slice(1).map((t, i) => - h(AssetView, {asset_index: i + 1, on_drag_begin: on_drag_begin, + let views = TILES.map((t, i) => + h(AssetView, {asset_index: i, on_drag_begin: on_drag_begin, on_drag_end: on_drag_end})); return h("div", {}, views); } @@ -91,8 +96,13 @@ function PlanGridView({content, mouse_state}) if(idx == 0) return null; let cell_x = i % GRID_SIZE_X; let cell_y = Math.floor(i / GRID_SIZE_Y); + let bg = ASSET_WHITE_BG; + if(TILES[idx].bg === null) + { + bg = null; + } return h("g", {"transform": `translate(${cell_x * (CELL_SIZE + 1) + 1} \ -${cell_y * (CELL_SIZE + 1) + 1})`}, ASSET_WHITE_BG, TILES[idx].inner_svg); +${cell_y * (CELL_SIZE + 1) + 1})`}, bg, TILES[idx].inner_svg); }); let img_width = GRID_SIZE_X * (CELL_SIZE + 1) + 1; @@ -101,7 +111,7 @@ ${cell_y * (CELL_SIZE + 1) + 1})`}, ASSET_WHITE_BG, TILES[idx].inner_svg); "version": "1.1", "ondragover": onDragOver, "id": "Grid", "ondragleave": onDragLeave,}, h("rect", {x: 0, y: 0, width: img_width, height: img_height, - fill: "#a4b0be", "stroke-width": 0}), + fill: "#c0c0c0", "stroke-width": 0}), grid_content, genGrid(GRID_SIZE_X, GRID_SIZE_Y, CELL_SIZE + 1), hilight_box); } @@ -116,7 +126,7 @@ function PlanView({plan, mouse_state}) // on_floor_change takes one argument, which is the 0-based floor number. function FloorSelector({floor, on_floor_change}) { - return h("div", {"id": "FloorSelectorWrapper", "class": "ButtonRow"}, + return h("div", {"id": "FloorSelectorWrapper", "class": "ButtonRowLeft"}, h("label", {}, "Floor"), h("input", {"id": "InputFloor", "type": "number", "step": 1, "min": 1, "max": 15, "value": floor, -- cgit v1.2.3-70-g09d2