Commit e2b7a9502bbe36343fd1b924a5ccbada21ad28d7
1 parent
08a27d90
perf: perf lssued instructions throttle
Showing
1 changed file
with
33 additions
and
10 deletions
... | ... | @@ -12866,6 +12866,9 @@ class HandleDataSource { |
12866 | 12866 | } |
12867 | 12867 | |
12868 | 12868 | instance.setOption(chartOption) |
12869 | + instance.on('dataZoom', () => { | |
12870 | + console.log(instance.getOption()) | |
12871 | + }) | |
12869 | 12872 | // instance.on('mouseover', stop) |
12870 | 12873 | // instance.on('mouseout', goMove) |
12871 | 12874 | // autoMove() |
... | ... | @@ -13002,13 +13005,17 @@ class HandleDataInteraction { |
13002 | 13005 | graphClick.apply(this.graph, args) |
13003 | 13006 | } |
13004 | 13007 | |
13008 | + const mouseDownEvent = this.throttle(this.handleMouseDownEvent) | |
13009 | + const mouseUpEvent = this.throttle(this.handleMouseUpEvent) | |
13005 | 13010 | const graphFireMouseEvent = this.graph.fireMouseEvent; |
13006 | 13011 | this.graph.fireMouseEvent = (eventName, event, sender) => { |
13007 | 13012 | if (eventName === mxEvent.MOUSE_DOWN) { |
13008 | - this.handleMouseDownEvent(eventName, event, sender) | |
13013 | + // this.handleMouseDownEvent(eventName, event, sender) | |
13014 | + mouseDownEvent(eventName, event, sender) | |
13009 | 13015 | } |
13010 | 13016 | if (eventName === mxEvent.MOUSE_UP) { |
13011 | - this.handleMouseUpEvent(eventName, event, sender) | |
13017 | + mouseUpEvent(eventName, event, sender) | |
13018 | + // this.handleMouseUpEvent(eventName, event, sender) | |
13012 | 13019 | } |
13013 | 13020 | graphFireMouseEvent.apply(this.graph, [eventName, event, sender]); |
13014 | 13021 | }; |
... | ... | @@ -13047,7 +13054,7 @@ class HandleDataInteraction { |
13047 | 13054 | } |
13048 | 13055 | |
13049 | 13056 | /** |
13050 | - * @description 鼠标双击事件 | |
13057 | + * @description 鼠标单击事件事件 | |
13051 | 13058 | * @param event |
13052 | 13059 | */ |
13053 | 13060 | handleClickEvent(event) { |
... | ... | @@ -13056,16 +13063,16 @@ class HandleDataInteraction { |
13056 | 13063 | if (temp && temp.has(DispatchCenter.enumEventType.SINGLE)) { |
13057 | 13064 | const content = temp.get(DispatchCenter.enumEventType.SINGLE) |
13058 | 13065 | const { type, value } = content |
13059 | - if (type === DispatchCenter.enumPageType.PAGE) { | |
13066 | + if (type === DispatchCenter.enumPageType.PAGE && value) { | |
13060 | 13067 | this.jumpPage(value) |
13061 | - } else if (type === DispatchCenter.enumPageType.LINK) { | |
13068 | + } else if (type === DispatchCenter.enumPageType.LINK && value) { | |
13062 | 13069 | window.open(value) |
13063 | 13070 | } |
13064 | 13071 | } |
13065 | 13072 | } |
13066 | 13073 | |
13067 | 13074 | /** |
13068 | - * @description 鼠标单击事件 | |
13075 | + * @description 鼠标双击事件 | |
13069 | 13076 | * @param event |
13070 | 13077 | * @param cell |
13071 | 13078 | */ |
... | ... | @@ -13075,9 +13082,9 @@ class HandleDataInteraction { |
13075 | 13082 | if (temp && temp.has(DispatchCenter.enumEventType.DOUBLE)) { |
13076 | 13083 | const content = temp.get(DispatchCenter.enumEventType.DOUBLE) |
13077 | 13084 | const { type, value } = content |
13078 | - if (type === DispatchCenter.enumPageType.PAGE) { | |
13085 | + if (type === DispatchCenter.enumPageType.PAGE && value) { | |
13079 | 13086 | this.jumpPage(value) |
13080 | - } else if (type === DispatchCenter.enumPageType.LINK) { | |
13087 | + } else if (type === DispatchCenter.enumPageType.LINK && value) { | |
13081 | 13088 | window.open(value) |
13082 | 13089 | } |
13083 | 13090 | } |
... | ... | @@ -13120,11 +13127,27 @@ class HandleDataInteraction { |
13120 | 13127 | Promise.all(queue.map(fn => fn())) |
13121 | 13128 | } |
13122 | 13129 | |
13130 | + throttle(fn, time = 1000) { | |
13131 | + let now = Date.now | |
13132 | + let oldTime = now() | |
13133 | + return (...args) => { | |
13134 | + let newTime = now() | |
13135 | + if (newTime - oldTime > time) { | |
13136 | + oldTime = now() | |
13137 | + fn.apply(this, args) | |
13138 | + } | |
13139 | + } | |
13140 | + } | |
13141 | + | |
13123 | 13142 | /** |
13124 | 13143 | * @description 跳转页面 |
13125 | 13144 | */ |
13126 | 13145 | jumpPage(page) { |
13127 | - this.editorUi.handleCustomLink(`data:page/id,${page}`) | |
13146 | + try { | |
13147 | + this.editorUi.handleCustomLink(`data:page/id,${page}`) | |
13148 | + } catch (error) { | |
13149 | + throw error | |
13150 | + } | |
13128 | 13151 | } |
13129 | 13152 | } |
13130 | 13153 | |
... | ... | @@ -13484,7 +13507,7 @@ class HandleDynamicEffect { |
13484 | 13507 | } |
13485 | 13508 | |
13486 | 13509 | /** |
13487 | - * @description 验证优先级 | |
13510 | + * @description 验证数据动效优先级 显示隐藏优先级最高 | |
13488 | 13511 | * @param {string} nodeId |
13489 | 13512 | * @returns |
13490 | 13513 | */ | ... | ... |