Skip to content

app.editor.select手动选择locked元素异常 #859

@hanlinz

Description

@hanlinz
  • 给多个元素设置locked: true

  • 使用app.editor.select选择多个元素

  • 第一个元素不会被选中,其他元素可以被选中

  • 与元素无关,当app.editor.select(数组)的时候,数组的第一项不论是哪个元素都不会被选中

  • 如果元素没有locked属性,那么选中的效果是正常的


// #图形编辑器 [手动选择元素]
import { App, Rect } from 'leafer-ui'
import '@leafer-in/editor' // 导入图形编辑器插件
import '@leafer-in/viewport' // 导入视口插件 (可选)

const app = new App({
    view: window,
    editor: {}
})

const rect1 = (Rect.one({
    editable: true,
    fill: '#FEB027',
    cornerRadius: [20, 0, 0, 20],
    locked: true
}, 100, 100))
const rect2 = (Rect.one({
    editable: true,
    fill: '#FFE04B',
    cornerRadius: [0, 20, 20, 0],
    locked: true
}, 300, 100))

app.tree.addMany(rect1, rect2)
setTimeout(() => {
    // 手动选择元素 
    app.editor.select([rect1, rect2]) 
    console.warn(app.editor.list.length)
}, 1000)

截图:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions