Skip to content

Commit

Permalink
优化代码逻辑,减少内存占用
Browse files Browse the repository at this point in the history
  • Loading branch information
SilentTiger committed Nov 28, 2019
1 parent 732c312 commit 846bf0c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scripts/DocStructure/LayoutFrame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default class LayoutFrame extends LinkedList<Fragment> implements ILinked
*/
public addLine(line: Line) {
this.lines.push(line)
line.em.on(EventName.LINE_CHANGE_SIZE, this.childrenSizeChangeHandler)
line.em.on(EventName.LINE_CHANGE_SIZE, this.childrenSizeChangeHandler, this)

const newWidth = Math.max(this.width, line.x + line.width)
const newHeight = this.height + line.height
Expand Down Expand Up @@ -1000,7 +1000,7 @@ export default class LayoutFrame extends LinkedList<Fragment> implements ILinked
this.height = height
}

private childrenSizeChangeHandler = () => {
private childrenSizeChangeHandler() {
const size = this.calSize()
this.setSize(size.height, size.width)
}
Expand Down

0 comments on commit 846bf0c

Please sign in to comment.