mirror of
https://github.com/penpot/penpot.git
synced 2025-08-03 18:28:24 +02:00
🐛 Fix incorrect boolean shapes generation on builder
This commit is contained in:
parent
77fa235965
commit
89a09346a5
4 changed files with 130 additions and 26 deletions
|
@ -1,5 +1,11 @@
|
|||
# CHANGELOG
|
||||
|
||||
## 1.0.2
|
||||
|
||||
- Fix incorrect boolean type assignation
|
||||
- Fix fill and stroke handling on boolean shape creation
|
||||
- Add sample-bool.js to the playground directory
|
||||
|
||||
## 1.0.1
|
||||
|
||||
- Make the library generate a .penpot file compatible with penpot 2.7.x
|
||||
|
|
58
library/playground/sample-bool.js
Normal file
58
library/playground/sample-bool.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
import * as penpot from "#self";
|
||||
import { writeFile, readFile } from "fs/promises";
|
||||
|
||||
(async function () {
|
||||
const context = penpot.createBuildContext();
|
||||
|
||||
{
|
||||
context.addFile({ name: "Test File 1" });
|
||||
context.addPage({ name: "Foo Page" });
|
||||
|
||||
const groupId = context.addGroup({
|
||||
name: "Bool Group"
|
||||
})
|
||||
|
||||
context.addRect({
|
||||
name: "Rect 1",
|
||||
x: 20,
|
||||
y: 20,
|
||||
width:100,
|
||||
height:100,
|
||||
});
|
||||
|
||||
context.addRect({
|
||||
name: "Rect 2",
|
||||
x: 90,
|
||||
y: 90,
|
||||
width:100,
|
||||
height:100,
|
||||
fills: [{fillColor: "#fabada", fillOpacity:1}]
|
||||
});
|
||||
|
||||
context.closeGroup();
|
||||
context.addBool({
|
||||
groupId: groupId,
|
||||
type: "union"
|
||||
});
|
||||
|
||||
context.closeBoard();
|
||||
context.closeFile();
|
||||
}
|
||||
|
||||
{
|
||||
let result = await penpot.exportAsBytes(context);
|
||||
await writeFile("sample-bool.zip", result);
|
||||
}
|
||||
})()
|
||||
.catch((cause) => {
|
||||
console.error(cause);
|
||||
|
||||
const innerCause = cause.cause;
|
||||
if (innerCause) {
|
||||
console.error("Inner cause:", innerCause);
|
||||
}
|
||||
process.exit(-1);
|
||||
})
|
||||
.finally(() => {
|
||||
process.exit(0);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue