You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am facing a problem when trying to use the simplest version of the lib, the packer.js (even though the filename refers to the other one)
It turns out that the following code:
/** * Handle main data generation. This method generate only raw data, used by another API (INSERT LATE) to generate real used data. * @param {*} req * @param {*} res * @return {void} */
getOffsets: (req,res)=>{// Necessary dataconstmdfData={height: 1000,width: 800}// Import optimizer library and instantiate itconstgrowingPacker=require('../vendor/packer.growing.js');constpacker=newgrowingPacker(800,1000);// This will take data to generate offsetsletpieces=[{h: 21100,w: 2220},{h: 1000,w: 22000},{h: 1000,w: 22000},{h: 1000,w: 22000},{h: 1000,w: 22000},{h: 1000,w: 22000},{h: 1000,w: 22000},{h: 2000,w: 22000},{h: 1000,w: 22000},];// Sort pieces by heightpieces.sort((a,b)=>{return(b.h<a.h)});// Generate offsetspacker.fit(pieces);console.log(pieces);res.send(pieces)}
I was using Growing at first, which was generating the expected data output, but the feature I am developing requires me to enter a width/height limit.
If you can help me, I would be very grateful.
Thanks in advance, and sorry for the bad English
The text was updated successfully, but these errors were encountered:
Hello, I am facing a problem when trying to use the simplest version of the lib, the packer.js (even though the filename refers to the other one)
It turns out that the following code:
It is generating this output:
My packer.growing.js looks like this:
I am using Node + ExpressJS for development.
I was using Growing at first, which was generating the expected data output, but the feature I am developing requires me to enter a width/height limit.
If you can help me, I would be very grateful.
Thanks in advance, and sorry for the bad English
The text was updated successfully, but these errors were encountered: