Skip to content

Commit

Permalink
Fix grid offset
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmi committed Apr 2, 2022
1 parent 3242957 commit 8838f03
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/board/Items/Item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const ItemWrapper = styled.div`
display: inline-block;
transition: transform 150ms;
user-select: none;
padding: 4px;
padding: 2px;
transform: rotate(${({ rotation }) => rotation}deg);
& .corner {
Expand Down Expand Up @@ -35,7 +35,7 @@ const ItemWrapper = styled.div`
&.selected {
border: 2px dashed #db5034;
padding: 2px;
padding: 0px;
cursor: pointer;
}
Expand Down
4 changes: 2 additions & 2 deletions src/board/Items/useItemActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ const useItemActions = () => {
}

const [centerX, centerY] = [
item.x + elem.clientWidth / 2,
item.y + elem.clientHeight / 2,
item.x + elem.clientWidth / 2 - offsetX,
item.y + elem.clientHeight / 2 - offsetY,
];

let newX;
Expand Down
4 changes: 2 additions & 2 deletions src/board/Selection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ const BoundingBox = () => {
style={{
...defaultZoneStyle,
transform: `translate(${boundingBoxLast.left}px, ${boundingBoxLast.top}px)`,
height: `${boundingBoxLast.height}px`,
width: `${boundingBoxLast.width}px`,
height: `${boundingBoxLast.height - 2}px`,
width: `${boundingBoxLast.width - 2}px`,
}}
className="selection"
/>
Expand Down
10 changes: 5 additions & 5 deletions src/stories/MainView.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,24 @@ const initialItems = [
layer: 2,
},
{
type: "rect",
type: "round",
x: 200,
y: -200,
id: "test-grid",
color: "#3327AA",
width: 100,
height: 100,
grid: { type: "hexV", size: 20, offset: { x: 5, y: 5 } },
grid: { type: "hexH", size: 50, offset: { x: 10, y: 10 } },
},
{
type: "rect",
type: "round",
x: 220,
y: -220,
id: "test-grid2",
color: "#3327AA",
color: "#aa2722",
width: 100,
height: 100,
grid: { type: "hexV", size: 20 },
grid: { type: "hexH", size: 50 },
},
];

Expand Down

0 comments on commit 8838f03

Please sign in to comment.