Commit e6992e87d96e531b42d5656c1d2e4ea8b5b6b171
1 parent
819b08d0
fix: implement dynamic effect priority
Showing
1 changed file
with
65 additions
and
39 deletions
| @@ -5579,7 +5579,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -5579,7 +5579,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
| 5579 | const { dataSources = [] } = currentNodeData | 5579 | const { dataSources = [] } = currentNodeData |
| 5580 | const { additional = {} } = dataSources[0] || {} | 5580 | const { additional = {} } = dataSources[0] || {} |
| 5581 | const { [enumBindKey.EFFECT_SCOPE]: effectScope = 1000 } = additional | 5581 | const { [enumBindKey.EFFECT_SCOPE]: effectScope = 1000 } = additional |
| 5582 | - console.log(additional) | ||
| 5583 | linkageIntervalSelect(effectScope) | 5582 | linkageIntervalSelect(effectScope) |
| 5584 | form.val(CONTAINER_FILTER, additional) | 5583 | form.val(CONTAINER_FILTER, additional) |
| 5585 | } | 5584 | } |
| @@ -7267,7 +7266,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -7267,7 +7266,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
| 7267 | } | 7266 | } |
| 7268 | 7267 | ||
| 7269 | function getValue() { | 7268 | function getValue() { |
| 7270 | - console.log(form.val(componentFilter)) | ||
| 7271 | return form.val(componentFilter) | 7269 | return form.val(componentFilter) |
| 7272 | } | 7270 | } |
| 7273 | 7271 | ||
| @@ -12626,7 +12624,7 @@ class HandleDataSource { | @@ -12626,7 +12624,7 @@ class HandleDataSource { | ||
| 12626 | const seriesValue = [] | 12624 | const seriesValue = [] |
| 12627 | const chartOption = { | 12625 | const chartOption = { |
| 12628 | title: { | 12626 | title: { |
| 12629 | - subtext: realDataList.length ? '' :'暂无数据', | 12627 | + subtext: realDataList.length ? '' : '暂无数据', |
| 12630 | x: 'center', | 12628 | x: 'center', |
| 12631 | y: 'center', | 12629 | y: 'center', |
| 12632 | itemGap: -20, | 12630 | itemGap: -20, |
| @@ -12672,11 +12670,9 @@ class HandleDataSource { | @@ -12672,11 +12670,9 @@ class HandleDataSource { | ||
| 12672 | ], | 12670 | ], |
| 12673 | dataZoom: [ | 12671 | dataZoom: [ |
| 12674 | { | 12672 | { |
| 12675 | - xAxisIndex: 0, | ||
| 12676 | show: true, | 12673 | show: true, |
| 12677 | type: 'slider', | 12674 | type: 'slider', |
| 12678 | - startValue: 0, | ||
| 12679 | - endValue: showNumberOf | 12675 | + // endValue: showNumberOf |
| 12680 | } | 12676 | } |
| 12681 | ] | 12677 | ] |
| 12682 | } | 12678 | } |
| @@ -12730,17 +12726,21 @@ class HandleDataSource { | @@ -12730,17 +12726,21 @@ class HandleDataSource { | ||
| 12730 | ], | 12726 | ], |
| 12731 | dataZoom: [ | 12727 | dataZoom: [ |
| 12732 | { | 12728 | { |
| 12733 | - startValue: seriesValue.length - 1 > showNumberOf | ||
| 12734 | - ? oldStartValue === seriesValue.length - 1 | ||
| 12735 | - ? 0 | ||
| 12736 | - : oldStartValue + 1 | ||
| 12737 | - : 0, | ||
| 12738 | - endValue: seriesValue.length - 1 > showNumberOf | ||
| 12739 | - ? oldEndValue === seriesValue.length - 1 | ||
| 12740 | - ? showNumberOf | ||
| 12741 | - : oldEndValue + 1 | ||
| 12742 | - : showNumberOf | 12729 | + show: true, |
| 12730 | + type: 'slider', | ||
| 12743 | } | 12731 | } |
| 12732 | + // { | ||
| 12733 | + // startValue: seriesValue.length - 1 > showNumberOf | ||
| 12734 | + // ? oldStartValue === seriesValue.length - 1 | ||
| 12735 | + // ? 0 | ||
| 12736 | + // : oldStartValue + 1 | ||
| 12737 | + // : 0, | ||
| 12738 | + // endValue: seriesValue.length - 1 > showNumberOf | ||
| 12739 | + // ? oldEndValue === seriesValue.length - 1 | ||
| 12740 | + // ? showNumberOf | ||
| 12741 | + // : oldEndValue + 1 | ||
| 12742 | + // : showNumberOf | ||
| 12743 | + // } | ||
| 12744 | ] | 12744 | ] |
| 12745 | }) | 12745 | }) |
| 12746 | } | 12746 | } |
| @@ -12768,7 +12768,7 @@ class HandleDataSource { | @@ -12768,7 +12768,7 @@ class HandleDataSource { | ||
| 12768 | const seriesValue = [] | 12768 | const seriesValue = [] |
| 12769 | const chartOption = { | 12769 | const chartOption = { |
| 12770 | title: { | 12770 | title: { |
| 12771 | - subtext: historyDataList.length ? '' :'暂无数据', | 12771 | + subtext: historyDataList.length ? '' : '暂无数据', |
| 12772 | x: 'center', | 12772 | x: 'center', |
| 12773 | y: 'center', | 12773 | y: 'center', |
| 12774 | itemGap: -20, | 12774 | itemGap: -20, |
| @@ -12815,11 +12815,11 @@ class HandleDataSource { | @@ -12815,11 +12815,11 @@ class HandleDataSource { | ||
| 12815 | ], | 12815 | ], |
| 12816 | dataZoom: [ | 12816 | dataZoom: [ |
| 12817 | { | 12817 | { |
| 12818 | - xAxisIndex: 0, | ||
| 12819 | - show: false, | 12818 | + // xAxisIndex: 0, |
| 12819 | + show: true, | ||
| 12820 | type: 'slider', | 12820 | type: 'slider', |
| 12821 | - startValue: 0, | ||
| 12822 | - endValue: showNumberOf | 12821 | + // startValue: 0, |
| 12822 | + // endValue: showNumberOf | ||
| 12823 | } | 12823 | } |
| 12824 | ] | 12824 | ] |
| 12825 | } | 12825 | } |
| @@ -12860,9 +12860,9 @@ class HandleDataSource { | @@ -12860,9 +12860,9 @@ class HandleDataSource { | ||
| 12860 | } | 12860 | } |
| 12861 | 12861 | ||
| 12862 | instance.setOption(chartOption) | 12862 | instance.setOption(chartOption) |
| 12863 | - instance.on('mouseover', stop) | ||
| 12864 | - instance.on('mouseout', goMove) | ||
| 12865 | - autoMove() | 12863 | + // instance.on('mouseover', stop) |
| 12864 | + // instance.on('mouseout', goMove) | ||
| 12865 | + // autoMove() | ||
| 12866 | } | 12866 | } |
| 12867 | 12867 | ||
| 12868 | /** | 12868 | /** |
| @@ -13141,7 +13141,7 @@ class HandleDynamicEffect { | @@ -13141,7 +13141,7 @@ class HandleDynamicEffect { | ||
| 13141 | 13141 | ||
| 13142 | /** | 13142 | /** |
| 13143 | * @description 动效节点映射 | 13143 | * @description 动效节点映射 |
| 13144 | - * @type {Map<string, Map<string, any>>} | 13144 | + * @type {Map<string, {display: boolean, value: Map<string, any>}>} |
| 13145 | */ | 13145 | */ |
| 13146 | actNodeMapping = new Map() | 13146 | actNodeMapping = new Map() |
| 13147 | 13147 | ||
| @@ -13223,9 +13223,9 @@ class HandleDynamicEffect { | @@ -13223,9 +13223,9 @@ class HandleDynamicEffect { | ||
| 13223 | this.enableActList.forEach(each => { | 13223 | this.enableActList.forEach(each => { |
| 13224 | const { id, type, attr, deviceId, slaveDeviceId } = each | 13224 | const { id, type, attr, deviceId, slaveDeviceId } = each |
| 13225 | 13225 | ||
| 13226 | - if (!this.actNodeMapping.has(id)) this.actNodeMapping.set(id, new Map()) | 13226 | + if (!this.actNodeMapping.has(id)) this.actNodeMapping.set(id, { display: true, value: new Map() }) |
| 13227 | const temp = this.actNodeMapping.get(id) | 13227 | const temp = this.actNodeMapping.get(id) |
| 13228 | - temp.set(type, each) | 13228 | + temp.value.set(type, each) |
| 13229 | 13229 | ||
| 13230 | const cmdId = this.DispatchInstance.getCmdId(id) | 13230 | const cmdId = this.DispatchInstance.getCmdId(id) |
| 13231 | 13231 | ||
| @@ -13303,6 +13303,11 @@ class HandleDynamicEffect { | @@ -13303,6 +13303,11 @@ class HandleDynamicEffect { | ||
| 13303 | rotate(message) { | 13303 | rotate(message) { |
| 13304 | const { subscriptionId, data } = message | 13304 | const { subscriptionId, data } = message |
| 13305 | const node = this.getNodeByCmdId(subscriptionId) | 13305 | const node = this.getNodeByCmdId(subscriptionId) |
| 13306 | + const key = node.id + DispatchCenter.enumDynamicEffectType.ROTATE | ||
| 13307 | + if (!this.validatePriority(node.id)) { | ||
| 13308 | + this.delUpdateFn(key) | ||
| 13309 | + return | ||
| 13310 | + } | ||
| 13306 | const { flag } = this.validate(subscriptionId, DispatchCenter.enumDynamicEffectType.ROTATE, data) | 13311 | const { flag } = this.validate(subscriptionId, DispatchCenter.enumDynamicEffectType.ROTATE, data) |
| 13307 | let deg = 0 | 13312 | let deg = 0 |
| 13308 | const updateFn = () => { | 13313 | const updateFn = () => { |
| @@ -13311,16 +13316,14 @@ class HandleDynamicEffect { | @@ -13311,16 +13316,14 @@ class HandleDynamicEffect { | ||
| 13311 | let style = node.getStyle() | 13316 | let style = node.getStyle() |
| 13312 | const reg = /rotation=(-?)\w+(;?)/g | 13317 | const reg = /rotation=(-?)\w+(;?)/g |
| 13313 | style = style.replace(reg, '') | 13318 | style = style.replace(reg, '') |
| 13314 | - style += `rotation=${deg}` | 13319 | + style += `rotation=${deg};` |
| 13315 | node.setStyle(style) | 13320 | node.setStyle(style) |
| 13316 | this.graph.updateCellStyles(style, node) | 13321 | this.graph.updateCellStyles(style, node) |
| 13317 | } | 13322 | } |
| 13318 | - const key = node.id + DispatchCenter.enumDynamicEffectType.ROTATE | ||
| 13319 | if (!flag) { | 13323 | if (!flag) { |
| 13320 | this.delUpdateFn(key) | 13324 | this.delUpdateFn(key) |
| 13321 | return | 13325 | return |
| 13322 | } | 13326 | } |
| 13323 | - console.log(this.actNodeMapping) | ||
| 13324 | this.insertContinueUpdateFn(node, updateFn, key) | 13327 | this.insertContinueUpdateFn(node, updateFn, key) |
| 13325 | } | 13328 | } |
| 13326 | 13329 | ||
| @@ -13335,19 +13338,29 @@ class HandleDynamicEffect { | @@ -13335,19 +13338,29 @@ class HandleDynamicEffect { | ||
| 13335 | if (!flag) return | 13338 | if (!flag) return |
| 13336 | const node = this.getNodeByCmdId(subscriptionId) | 13339 | const node = this.getNodeByCmdId(subscriptionId) |
| 13337 | let isShow = false | 13340 | let isShow = false |
| 13338 | - if (node.visible && condition.type === HandleDynamicEffect.enumDisplayType.SHOW) { | ||
| 13339 | - return | ||
| 13340 | - } else if (condition.type === HandleDynamicEffect.enumDisplayType.SHOW) { | 13341 | + if (condition.type === HandleDynamicEffect.enumDisplayType.SHOW) { |
| 13341 | isShow = true | 13342 | isShow = true |
| 13342 | } else if (condition.type === HandleDynamicEffect.enumDisplayType.HIDDEN) { | 13343 | } else if (condition.type === HandleDynamicEffect.enumDisplayType.HIDDEN) { |
| 13343 | isShow = false | 13344 | isShow = false |
| 13344 | } | 13345 | } |
| 13345 | const updateFn = () => { | 13346 | const updateFn = () => { |
| 13347 | + // let style = node.getStyle() | ||
| 13348 | + // const reg = /opacity=(-?)\w+(;?)/g | ||
| 13349 | + // style = style.replace(reg, '') | ||
| 13350 | + // style += `opacity=${isShow ? 100 : 0};` | ||
| 13351 | + // console.log(style) | ||
| 13352 | + // node.setStyle(style) | ||
| 13353 | + | ||
| 13354 | + if (!isShow) { | ||
| 13355 | + Object.keys(HandleDynamicEffect.enumActType).forEach(key => { | ||
| 13356 | + const delKey = node.id + key | ||
| 13357 | + this.delUpdateFn(delKey) | ||
| 13358 | + }) | ||
| 13359 | + const temp = this.actNodeMapping.get(node.id) | ||
| 13360 | + temp.display = false | ||
| 13361 | + } | ||
| 13362 | + | ||
| 13346 | node.setVisible(isShow) | 13363 | node.setVisible(isShow) |
| 13347 | - node.setAttribute('display', isShow) | ||
| 13348 | - console.log('isShow', isShow) | ||
| 13349 | - console.log(node.style) | ||
| 13350 | - console.log(node) | ||
| 13351 | } | 13364 | } |
| 13352 | this.insertOnceUpdateFn(node, updateFn) | 13365 | this.insertOnceUpdateFn(node, updateFn) |
| 13353 | } | 13366 | } |
| @@ -13360,13 +13373,17 @@ class HandleDynamicEffect { | @@ -13360,13 +13373,17 @@ class HandleDynamicEffect { | ||
| 13360 | flash(message) { | 13373 | flash(message) { |
| 13361 | const { subscriptionId, data } = message | 13374 | const { subscriptionId, data } = message |
| 13362 | const node = this.getNodeByCmdId(subscriptionId) | 13375 | const node = this.getNodeByCmdId(subscriptionId) |
| 13376 | + const key = node.id + DispatchCenter.enumDynamicEffectType.FLASH | ||
| 13377 | + if (!this.validatePriority(node.id)) { | ||
| 13378 | + this.delUpdateFn(key) | ||
| 13379 | + return | ||
| 13380 | + } | ||
| 13363 | const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.FLASH, data) | 13381 | const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.FLASH, data) |
| 13364 | let flashFlag = false | 13382 | let flashFlag = false |
| 13365 | const updateFn = () => { | 13383 | const updateFn = () => { |
| 13366 | node.setVisible(flashFlag) | 13384 | node.setVisible(flashFlag) |
| 13367 | flashFlag = !flashFlag | 13385 | flashFlag = !flashFlag |
| 13368 | } | 13386 | } |
| 13369 | - const key = node.id + DispatchCenter.enumDynamicEffectType.FLASH | ||
| 13370 | if (!flag) { | 13387 | if (!flag) { |
| 13371 | flashFlag = true | 13388 | flashFlag = true |
| 13372 | this.insertOnceUpdateFn(node, updateFn) | 13389 | this.insertOnceUpdateFn(node, updateFn) |
| @@ -13435,7 +13452,7 @@ class HandleDynamicEffect { | @@ -13435,7 +13452,7 @@ class HandleDynamicEffect { | ||
| 13435 | getBindData(subscriptionId, actionType) { | 13452 | getBindData(subscriptionId, actionType) { |
| 13436 | const nodeId = this.getNodeIdByCmdId(subscriptionId) | 13453 | const nodeId = this.getNodeIdByCmdId(subscriptionId) |
| 13437 | const temp = this.actNodeMapping.get(nodeId) | 13454 | const temp = this.actNodeMapping.get(nodeId) |
| 13438 | - return temp.get(actionType) | 13455 | + return temp.value.get(actionType) |
| 13439 | } | 13456 | } |
| 13440 | 13457 | ||
| 13441 | /** | 13458 | /** |
| @@ -13457,6 +13474,15 @@ class HandleDynamicEffect { | @@ -13457,6 +13474,15 @@ class HandleDynamicEffect { | ||
| 13457 | return this.DispatchInstance.contentAllCell.find(item => item.id === nodeId) | 13474 | return this.DispatchInstance.contentAllCell.find(item => item.id === nodeId) |
| 13458 | } | 13475 | } |
| 13459 | 13476 | ||
| 13477 | + /** | ||
| 13478 | + * @description 验证优先级 | ||
| 13479 | + * @param {string} nodeId | ||
| 13480 | + * @returns | ||
| 13481 | + */ | ||
| 13482 | + validatePriority(nodeId) { | ||
| 13483 | + return this.actNodeMapping.get(nodeId).display | ||
| 13484 | + } | ||
| 13485 | + | ||
| 13460 | } | 13486 | } |
| 13461 | 13487 | ||
| 13462 | class UpdateQueue { | 13488 | class UpdateQueue { |