Skip to content

Commit

Permalink
feat: node-editor新增width和height配置
Browse files Browse the repository at this point in the history
  • Loading branch information
aflextyang committed Aug 3, 2023
1 parent 7a160d2 commit 66dbbad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/x6/src/registry/tool/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export class CellEditor extends ToolsView.ToolItem<
let minWidth = 20
let translate = ''
let { x, y } = this.options
const { width, height } = this.options

if (typeof x !== 'undefined' && typeof y !== 'undefined') {
const bbox = cell.getBBox()
Expand All @@ -105,6 +106,13 @@ export class CellEditor extends ToolsView.ToolItem<
style.top = `${pos.y}px`
style.transform = `scale(${scale.sx}, ${scale.sy}) ${translate}`
style.minWidth = `${minWidth}px`

if (typeof width === 'number') {
style.width = `${width}px`
}
if (typeof height === 'number') {
style.height = `${height}px`
}
}

updateEdgeEditorTransform() {
Expand Down Expand Up @@ -270,6 +278,8 @@ export namespace CellEditor {
export interface CellEditorOptions extends ToolsView.ToolItem.Options {
x?: number | string
y?: number | string
width?: number
height?: number
attrs: {
fontSize: number
fontFamily: string
Expand Down

0 comments on commit 66dbbad

Please sign in to comment.