// #视图控制 [放大]
import { App, Rect, Frame } from 'leafer-ui'
import '@leafer-in/editor' // 导入图形编辑器插件
import '@leafer-in/viewport' // 导入视口插件(可选)
import '@leafer-in/view' // 导入视图控制插件
import { Editor } from "@leafer-in/editor";
import { Leafer } from "leafer-ui";
const app = new App({
view: window,
fill: "transparent",
hittable: true,
smooth: true,
pointer: {
preventDefaultMenu: false,
},
wheel: {
zoomMode: "mouse",
zoomSpeed: 1,
moveSpeed: 1,
},
move: {
drag: "auto",
holdRightKey: false,
dragEmpty: true,
dragAnimate: true,
},
sky: {},
ground: {
type: "design",
},
})
const editor = new Editor({
flipable: false,
skewable: false,
boxSelect: false,
stroke: "#171717",
point: { cornerRadius: 0, stroke: "#171717" },
middlePoint: {
cornerRadius: 0,
stroke: "#171717",
},
circle: {
cornerRadius: 0,
stroke: "#171717",
},
circleDirection: "top",
circleMargin: 20,
rect: {
dashPattern: [3, 2],
},
rotateGap: 45,
})
const tree = new Leafer({
type: "design",
})
app.tree = tree
app.addBefore(tree, app.sky)
app.editor = editor
app.sky.add(editor)
const ground = new Frame({
hitSelf: false,
id: 'workspace',
width: 5000,
height: 3000,
x: 0,
y: 0,
fill: "#eee",
stroke: "#ccc"
})
const frame = new Frame({
id: 'frame',
width: 5000,
height: 3000,
x: 0,
y: 0,
overflow: "hide",
fill: "transparent",
})
const frame2 = new Frame({
id: 'frame2',
width: 5000,
height: 3000,
x: 0,
y: 0,
overflow: "hide",
fill: "transparent",
hitSelf: false,
})
const rect = new Rect({
width: 100,
height: 100,
fill: '#32cd79',
cornerRadius: [0, 40, 20, 40],
editable: true,
hitChildren: true,
origin: "center",
dragBounds: "parent",
})
app.ground.add(ground)
app.tree.add(frame)
frame.add(frame2)
frame2.add(rect)

// #视图控制 [放大]
import { App, Rect, Frame } from 'leafer-ui'
import '@leafer-in/editor' // 导入图形编辑器插件
import '@leafer-in/viewport' // 导入视口插件(可选)
import '@leafer-in/view' // 导入视图控制插件
import { Editor } from "@leafer-in/editor";
import { Leafer } from "leafer-ui";
const app = new App({
view: window,
fill: "transparent",
hittable: true,
smooth: true,
pointer: {
preventDefaultMenu: false,
},
wheel: {
zoomMode: "mouse",
zoomSpeed: 1,
moveSpeed: 1,
},
move: {
drag: "auto",
holdRightKey: false,
dragEmpty: true,
dragAnimate: true,
},
sky: {},
ground: {
type: "design",
},
})
const editor = new Editor({
flipable: false,
skewable: false,
boxSelect: false,
stroke: "#171717",
point: { cornerRadius: 0, stroke: "#171717" },
middlePoint: {
cornerRadius: 0,
stroke: "#171717",
},
circle: {
cornerRadius: 0,
stroke: "#171717",
},
circleDirection: "top",
circleMargin: 20,
rect: {
dashPattern: [3, 2],
},
rotateGap: 45,
})
const tree = new Leafer({
type: "design",
})
app.tree = tree
app.addBefore(tree, app.sky)
app.editor = editor
app.sky.add(editor)
const ground = new Frame({
hitSelf: false,
id: 'workspace',
width: 5000,
height: 3000,
x: 0,
y: 0,
fill: "#eee",
stroke: "#ccc"
})
const frame = new Frame({
id: 'frame',
width: 5000,
height: 3000,
x: 0,
y: 0,
overflow: "hide",
fill: "transparent",
})
const frame2 = new Frame({
id: 'frame2',
width: 5000,
height: 3000,
x: 0,
y: 0,
overflow: "hide",
fill: "transparent",
hitSelf: false,
})
const rect = new Rect({
width: 100,
height: 100,
fill: '#32cd79',
cornerRadius: [0, 40, 20, 40],
editable: true,
hitChildren: true,
origin: "center",
dragBounds: "parent",
})
app.ground.add(ground)
app.tree.add(frame)
frame.add(frame2)
frame2.add(rect)