Skip to content

Commit

Permalink
v1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
leaferjs committed Dec 26, 2024
1 parent 692e205 commit 4da45bd
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/app/config/type/app/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ const app = new App({
tree: { type: 'custom' } // 给 tree 层添加自定义视口 // [!code hl]
})

// 自定义平移视图 // [!code hl:11]
// 需要自定义平移视图逻辑 // [!code hl:11]
app.tree.on(MoveEvent.BEFORE_MOVE, (e: MoveEvent) => {
const { x, y } = app.tree.getValidMove(e.moveX, e.moveY)
app.tree.zoomLayer.move(x, y)
})

// 自定义缩放视图
// 需要自定义缩放视图逻辑
app.tree.on(ZoomEvent.BEFORE_ZOOM, (e: ZoomEvent) => {
const center = { x: e.x, y: e.y }
app.tree.zoomLayer.scaleOfWorld(center, app.tree.getValidScale(e.scale))
Expand Down
2 changes: 1 addition & 1 deletion src/app/config/type/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const canvas = document.body.appendChild(document.createElement('canvas'))
div.style.height = '600px'
div.innerText = '请往下滑,会出现一个矩形'

const leafer = new Leafer({ view: canvas, height: 800 })
const leafer = new Leafer({ view: canvas, height: 800 }) // 默认 block 类型,不要设置

const rect = new Rect({
x: 100,
Expand Down
4 changes: 2 additions & 2 deletions src/app/config/type/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ const leafer = new Leafer({
type: 'custom' // 添加自定义视口 // [!code hl]
})

// 自定义平移视图 // [!code hl:11]
// 需要自定义平移视图逻辑 // [!code hl:11]
leafer.on(MoveEvent.BEFORE_MOVE, (e: MoveEvent) => {
const { x, y } = leafer.getValidMove(e.moveX, e.moveY)
leafer.zoomLayer.move(x, y)
})

// 自定义缩放视图
// 需要自定义缩放视图逻辑
leafer.on(ZoomEvent.BEFORE_ZOOM, (e: ZoomEvent) => {
const center = { x: e.x, y: e.y }
leafer.zoomLayer.scaleOfWorld(center, leafer.getValidScale(e.scale))
Expand Down
2 changes: 1 addition & 1 deletion src/performance/million.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>Million Rects | Leafer UI</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<script src="https://unpkg.com/leafer-ui@1.2.0/dist/web.min.js"></script>
<script src="https://unpkg.com/leafer-ui@1.2.1/dist/web.min.js"></script>
</head>

<body></body>
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/editor/frame/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ app.tree.add(Frame.one({ // 页面内容
]
}, 100, 100, 500, 600))

app.sky.add(app.editor = new Editor()) // 添加图形编辑器,用于选中元素进行编辑操作 [!code hl]
app.sky.add(app.editor = new Editor()) // 添加图形编辑器,用于选中元素进行编辑操作 // [!code hl]
2 changes: 1 addition & 1 deletion src/plugin/editor/frame/origin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ app.tree.add(Frame.one({ // 页面内容
]
}, 100, 100, 500, 600))

app.sky.add(app.editor = new Editor()) // 添加图形编辑器,用于选中元素进行编辑操作 [!code hl]
app.sky.add(app.editor = new Editor()) // 添加图形编辑器,用于选中元素进行编辑操作 // [!code hl]
2 changes: 1 addition & 1 deletion src/plugin/editor/frame/simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ app.tree.add(Frame.one({ // 页面内容
]
}, 100, 100, 500, 600))

// app.sky.add(app.editor = new Editor()) // 添加图形编辑器,用于选中元素进行编辑操作 [!code hl]
// app.sky.add(app.editor = new Editor()) // 添加图形编辑器,用于选中元素进行编辑操作 // [!code hl]
8 changes: 4 additions & 4 deletions src/property/custom/addAttr-datatype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import { Leafer, Text, dataType } from 'leafer-ui'

const leafer = new Leafer({ view: window })

Text.addAttr('version', '1.2.0', dataType) // [!code hl]
Text.addAttr('version', '1.2.1', dataType) // [!code hl]

// default version

const text = new Text({ text: 'Welcome to LeaferJS' })

leafer.add(text)

console.log((text as any).version) // 1.2.0
console.log((text as any).version) // 1.2.1

// set version

const text2 = new Text({ version: '1.2.0' } as any)
const text2 = new Text({ version: '1.2.1' } as any)

console.log((text2 as any).version) // 1.2.0
console.log((text2 as any).version) // 1.2.1
2 changes: 1 addition & 1 deletion src/start/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>Demo | Leafer UI</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<script src="https://unpkg.com/leafer-ui@1.2.0/dist/web.min.js"></script>
<script src="https://unpkg.com/leafer-ui@1.2.1/dist/web.min.js"></script>
</head>
<body></body>
<script>
Expand Down
2 changes: 1 addition & 1 deletion src/worker/worker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 你也可以使用npm包模式,编译成js文件供worker调用
importScripts(
'https://unpkg.com/@leafer-ui/worker@1.2.0/dist/worker.min.js'
'https://unpkg.com/@leafer-ui/worker@1.2.1/dist/worker.min.js'
)

const { Leafer, Rect } = LeaferUI
Expand Down

0 comments on commit 4da45bd

Please sign in to comment.