Skip to content

Commit

Permalink
Support revers rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
odrick committed Dec 17, 2019
1 parent a4134f5 commit f2c5270
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/client/splitters/Spine.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ class Spine extends Splitter {
static get type() {
return 'Spine';
}

static get inverseRotation() {
return true;
}
}

export default Spine;
4 changes: 4 additions & 0 deletions src/client/splitters/Splitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class Splitter {

return name;
}

static get inverseRotation() {
return false;
}
}

export default Splitter;
2 changes: 1 addition & 1 deletion src/client/ui/SheetSplitter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class SheetSplitter extends React.Component {
ctx.save();

ctx.translate(item.spriteSourceSize.x + item.spriteSourceSize.w/2, item.spriteSourceSize.y + item.spriteSourceSize.h/2);
ctx.rotate(-Math.PI/2);
ctx.rotate(this.state.splitter.inverseRotation ? Math.PI/2 : -Math.PI/2);

let dx = trimmed ? item.spriteSourceSize.y - item.spriteSourceSize.h/2 : -item.spriteSourceSize.h/2;
let dy = trimmed ? -(item.spriteSourceSize.x + item.spriteSourceSize.w/2) : -item.spriteSourceSize.w/2;
Expand Down

0 comments on commit f2c5270

Please sign in to comment.