Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(label): define label in style and do not extra label from data
keep data used by biz fix#31
- Loading branch information
Showing
11 changed files
with
33 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,12 @@ | ||
import { Cell } from '../core/cell' | ||
import { events } from './events' | ||
import { BaseManager } from './base-manager' | ||
|
||
export class EditingManager extends BaseManager { | ||
updateLabel(cell: Cell, label: string, e?: Event) { | ||
this.model.batchUpdate(() => { | ||
const old = cell.data | ||
const data = this.graph.putLabel(cell, label) | ||
this.dataChanged(cell, data, this.graph.isAutoSizeCell(cell)) | ||
this.graph.trigger(events.labelChanged, { cell, data, old, e }) | ||
const style = { ...cell.style, label } | ||
this.graph.styleManager.setCellStyle(style, [cell]) | ||
}) | ||
return cell | ||
} | ||
|
||
protected dataChanged(cell: Cell, data: any, autoSize: boolean) { | ||
this.model.batchUpdate(() => { | ||
this.model.setData(cell, data) | ||
if (autoSize) { | ||
this.graph.sizeManager.cellSizeUpdated(cell, false) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters