static bool ApplySizeTool_CheckLevelOutsideOfRoom(IPlatformLayerSpatialData platform, IPlatformLayerTiles tiles,
                                                          ISizeData roomSize, Vector2Int newPos, Vector2Int newSize, out Vector2Int roomTileDim)
        {
            // level begins outside of room or a size-dimension is 0 -> empty level
            roomTileDim = roomSize.RoomTileDim();
            // ReSharper disable once ComplexConditionExpression
            if (newPos.x < roomTileDim.x && newPos.y < roomTileDim.y && newSize.x > 0 && newSize.y > 0)
            {
                return(false);
            }
            platform.Position = Vector2Int.zero;
            platform.Size     = Vector2Int.one;
            var newTiles = new ushort[platform.TileDim.x * platform.TileDim.y];

            tiles.SetTiles(newTiles);
            return(true);
        }
        static void ApplySizeTool(IPlatformLayerSpatialData platform, IPlatformLayerTiles tiles, ISizeData roomSize,
                                  SizePositionMod mod)
        {
            if (mod.SpecialCase)
            {
                mod.TileModifier = (mod.PosModifier * -1);
            }

            var sizeModifier   = mod.SizeModifier;
            var offsetModifier = mod.PosModifier;
            var tileModifier   = mod.TileModifier;

            var newSize = platform.TileDim + sizeModifier;
            var newPos  = platform.Position + offsetModifier;

            // level cannot begin before room begins, shrink size, add offset
            if (newPos.x < 0)
            {
                tileModifier += Vector2Int.right * newPos.x;
                newSize       = new Vector2Int(Mathf.Max(0, newSize.x + newPos.x), newSize.y);
                newPos        = new Vector2Int(0, newPos.y);
            }
            if (newPos.y < 0)
            {
                tileModifier += Vector2Int.up * newPos.y;
                newSize       = new Vector2Int(newSize.x, Mathf.Max(0, newSize.y + newPos.y));
                newPos        = new Vector2Int(newPos.x, 0);
            }

            if (ApplySizeTool_CheckLevelOutsideOfRoom(platform, tiles, roomSize, newPos, newSize, out var roomTileDim))
            {
                return;
            }

            CutIfOverflowing(newPos, ref newSize, roomTileDim);

            var newTiles = new ushort[newSize.x * newSize.y];

            //var newTiles = new PlatformLayerTilesArray() { Tiles_ = new PlatformLayerTilesBufferElement[newSize.x * newSize.y] };
            ApplySizeTool(platform, tiles, newSize, tileModifier, newTiles);
            platform.Position = newPos;
            platform.Size     = newSize - new Vector2Int(1, 1);
            tiles.SetTiles(newTiles);

            SceneView.RepaintAll();
        }