Skip to content

Commit

Permalink
Upgrade babel version, add MaxRectsPacker rotation support
Browse files Browse the repository at this point in the history
  • Loading branch information
odrick committed Dec 12, 2019
1 parent 336a888 commit bb59de0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
},
"homepage": "https://github.com/odrick/free-tex-packer",
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "^7.0.0",
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"@babel/preset-react": "^7.7.4",
"@jvitela/mustache-wax": "^1.0.1",
"babel-loader": "^8.0.5",
"babel-plugin-transform-runtime": "^6.23.0",
Expand All @@ -77,7 +77,7 @@
"glob": "^7.1.1",
"json-loader": "^0.5.4",
"jszip": "^3.1.3",
"maxrects-packer": "^2.0.0",
"maxrects-packer": "^2.5.0",
"mustache": "^3.0.1",
"optimist": "^0.6.1",
"plist": "^3.0.1",
Expand Down
7 changes: 5 additions & 2 deletions src/client/packers/MaxRectsPacker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
let MaxRectsPackerEngine = require("maxrects-packer").MaxRectsPacker;

import Packer from "./Packer";
import Rect from "../math/Rect";

const METHOD = {
Smart: "Smart",
Expand All @@ -22,7 +21,8 @@ class MaxRectsPacker extends Packer {
let options = {
smart: (method === METHOD.Smart || method === METHOD.SmartSquare),
pot: false,
square: (method === METHOD.Square || method === METHOD.SmartSquare)
square: (method === METHOD.Square || method === METHOD.SmartSquare),
allowRotation: this.allowRotate
};

let packer = new MaxRectsPackerEngine(this.binWidth, this.binHeight, 0, options);
Expand All @@ -43,6 +43,9 @@ class MaxRectsPacker extends Packer {
for(let item of rects) {
item.data.frame.x = item.x;
item.data.frame.y = item.y;
if (item.rot) {
item.data.rotated = true;
}
res.push(item.data);
}

Expand Down

0 comments on commit bb59de0

Please sign in to comment.