Comments (4)
The purpose of save
method is to save the freerects of a packer for later use, ie. adding more rects into the packer without overlapping the previous packed rects position.
The final result of the packed rects are stored in every rects position inside packer.bins
, example of access them:
packer.bins.forEach(bin => {
console.log(bin.rects);
});
This repo is just a simple packing algorithm module, so you have to find your own way storing them.
from maxrects-packer.
Thank you for your quick response!
I missread the readme about the purpose of the saving method. Maybe renaming it to saveSettings
is more clearly for developers?
Second,i need to send the packed bin as a post reqest. The packers -> bin -> rects holding instances of the rect class. Serialize this to get a plain js object makes the rects look like this: { _x: 0, _y: 0, _width: 100, _height: 100}
. This is why i thought the save method will create an correct rect without the underscores.
sure i found my own way already but maybe this are points to improve this simple nice module?
from maxrects-packer.
The packer.bin.rects
are Array of Objects extended from IRectangle
interface, take a look at:
maxrects-packer/src/geom/Rectangle.ts
Lines 1 to 7 in 11fd72c
You can simply use JSON.stringify()
to serialize as json. For more complicated export, take a look at
https://github.com/soimy/atlasify/blob/master/src/exporter.ts
from maxrects-packer.
BTW, Let's move this post to discussions
from maxrects-packer.
Related Issues (18)
- Packing result is worse when rotation allowed HOT 2
- alphabetical grouping HOT 3
- Actual examples? HOT 5
- Grouping rectangles to single bin HOT 11
- packer.addArray(array) fails if the array is empty and exclusiveTag: false is set
- Example broken
- Infinite recrusion when using addArray of oversized rect with non-exclusive tag matching HOT 2
- Allow rotation HOT 5
- Release 2.7.3 HOT 2
- Add CLI to do packing and image compositing on the go HOT 1
- Fixed placement for certain rectangles HOT 1
- System hang HOT 1
- addArray examples violate typescript types HOT 2
- Border padding ? HOT 7
- [FR] Packer free expanding in one dimension HOT 4
- Rectangle class typescript serialization
- Bugs in edgy rect placement in updateBinSize() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maxrects-packer.