diff --git a/CageUI/resources/web/CageUI/static/RoomBorder.svg b/CageUI/resources/web/CageUI/static/RoomBorder.svg index 577ce4e2f..43fc0b9f4 100644 --- a/CageUI/resources/web/CageUI/static/RoomBorder.svg +++ b/CageUI/resources/web/CageUI/static/RoomBorder.svg @@ -17,9 +17,9 @@ - */ --> - - + - \ No newline at end of file diff --git a/CageUI/src/client/components/layoutEditor/Editor.tsx b/CageUI/src/client/components/layoutEditor/Editor.tsx index 4853fa326..0c486768a 100644 --- a/CageUI/src/client/components/layoutEditor/Editor.tsx +++ b/CageUI/src/client/components/layoutEditor/Editor.tsx @@ -295,8 +295,9 @@ const Editor: FC = ({roomSize}) => { const updateItemType: RoomItemType = stringToRoomItem(parseWrapperId(draggedNodeId)); if (targetRect) { - const cellX = Math.max(0,targetRect.x); - const cellY = Math.max(0,targetRect.y); + // update the found x and y coords with new cell coords if the object was outside the available layout range. + const cellX = targetRect.x < SVG_WIDTH && targetRect.x > 0 ? targetRect.x : 0; + const cellY = targetRect.y < SVG_HEIGHT && targetRect.y > 0 ? targetRect.y : 0; let newId: string; diff --git a/CageUI/src/client/utils/constants.ts b/CageUI/src/client/utils/constants.ts index a3625df1a..aa66bb01e 100644 --- a/CageUI/src/client/utils/constants.ts +++ b/CageUI/src/client/utils/constants.ts @@ -19,8 +19,8 @@ import { Modification, ModLocations, ModRecord, ModTypes } from '../types/typings'; export const CELL_SIZE = 30; // number of pixels of a cell for length/width -export const SVG_WIDTH = 1290; // width of the layout svg -export const SVG_HEIGHT = 810; // height of the layout svg +export const SVG_WIDTH = 810; // width of the layout svg +export const SVG_HEIGHT = 1290; // height of the layout svg //TODO finish styles export const Modifications: ModRecord = {