Skip to content

Commit d11dfa0

Browse files
committed
改进图层切换机制
1 parent 2a02af0 commit d11dfa0

File tree

5 files changed

+247
-193
lines changed

5 files changed

+247
-193
lines changed

DVE/.idea/workspace.xml

Lines changed: 39 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DVE/Caryon/gobCaryon.js

Lines changed: 28 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var GobCaryon = function () {
3535
this.selectUpdateing = false;
3636
this.disableRender = false //不渲染
3737
this.disableAttrPanel = false //AttrPanel 关闭了,不需要更新
38-
this.updateTimestamp = ""
38+
this.updateTimestamp = null
3939

4040

4141
this.nowSwitching = false;//是否在切换选中图层中
@@ -1026,7 +1026,7 @@ GobCaryon.prototype._getData = function (names) {
10261026
/**
10271027
* 更新选中图层。会触发 GobCaryon.updateGob() 。
10281028
*/
1029-
GobCaryon.prototype.updateSelect = _.debounce(async function () {
1029+
GobCaryon.prototype.updateSelect = async function () {
10301030

10311031

10321032
if (this.disableSelectEvent)// 如果设置了停止选择更新开关则返回
@@ -1127,7 +1127,7 @@ GobCaryon.prototype.updateSelect = _.debounce(async function () {
11271127
console.log("selectUpdateing:false")
11281128
console.groupEnd()
11291129
logger.log("%c【结束】选中图层周期 -------------------- ", "color:#999;")
1130-
}, 500)
1130+
}
11311131

11321132

11331133
/*------------------------------------------------------------------*/
@@ -1323,7 +1323,14 @@ GobCaryon.prototype._setTypeColor = function (typeColor, color) {
13231323
* @param disableRender 禁止 Gob 更新期间渲染图层
13241324
* @returns {Promise.<void>}
13251325
*/
1326-
GobCaryon.prototype.updateGob = _.debounce(async function (disableRender) {
1326+
GobCaryon.prototype.updateGob = async function (disableRender) {
1327+
1328+
1329+
if (this.updateTimestamp != undefined)
1330+
{
1331+
console.info("updateGob updateTimestamp 未跳出")
1332+
return
1333+
}
13271334

13281335
var self = this;
13291336
var onceUpdateTimestamp = (new Date()).getTime().toString(36)
@@ -1417,8 +1424,8 @@ GobCaryon.prototype.updateGob = _.debounce(async function (disableRender) {
14171424
} else/*大于最大选中限制时,忽略*/
14181425
{
14191426
console.log("GobCaryon.updateGob 大于最大选中限制时,忽略")
1420-
_setObejctAll(temp, Gob.MULT)
14211427
Gob.position.$anchor = setSystem.gob.$anchor;
1428+
_setObejctAll(temp, Gob.MULT)
14221429

14231430
function _setObejctAll(object, value)
14241431
{
@@ -1439,6 +1446,8 @@ GobCaryon.prototype.updateGob = _.debounce(async function (disableRender) {
14391446
}
14401447
}
14411448

1449+
await sleep(1000)
1450+
14421451

14431452
}
14441453
}
@@ -1495,50 +1504,24 @@ GobCaryon.prototype.updateGob = _.debounce(async function (disableRender) {
14951504
console.timeEnd("属性赋值到 Gob 耗时:")
14961505
console.groupEnd()
14971506

1498-
sleep(50)
1499-
1500-
setTimeout(function () {
1501-
1502-
if (self.updateTimestamp == onceUpdateTimestamp)
1503-
{
1504-
self.disableRender = false;//恢复默认值;
1505-
self._neverUpdate = false //未更新过 = false
1506-
self.nowSwitching = false
1507-
console.log("【this.nowSwitching = false】", onceUpdateTimestamp)
1508-
}
1509-
1510-
}, 300)
1511-
1512-
1513-
// this.nowSwitching = false;
1514-
// this._asyncSetSwitch = false;
1515-
1516-
// //----------------更新图层后渲染
1517-
// console.log("this.selectRender:", this.selectRender, " varSystem.autoRender", setSystem.autoRender, " selectChanged:", this.selectChanged,
1518-
// " renderCaryon.status.rendering:", renderCaryon.status.rendering,
1519-
// )
1520-
// console.log("this.selectRenderVarList:", this.selectRenderVarList)
1521-
//
1522-
//
1523-
// if (this.selectRender && setSystem.autoRender && !this.selectChanged && !renderCaryon.status.rendering)
1524-
// {
1525-
// if (this.selectRenderVarList != undefined && this.selectRenderVarList.length > 0)
1526-
// {
1527-
// console.log("更新图层后渲染")
1528-
// // renderCaryon.renderDocument(true, this.selectRenderVarList)
1529-
// }
1530-
// }
1531-
console.groupEnd();
1507+
await sleep(500)
15321508

1509+
if (self.updateTimestamp == onceUpdateTimestamp)
1510+
{
1511+
self.disableRender = false;//恢复默认值;
1512+
self._neverUpdate = false //未更新过 = false
1513+
self.nowSwitching = false
1514+
console.log("【this.nowSwitching = false】", onceUpdateTimestamp)
1515+
this.updateTimestamp = null
1516+
}
15331517

15341518
if (this._unripe)
15351519
{
1536-
setTimeout(function () {
1537-
self._unripe = false;
1538-
logger.info("[准备完成] _unripe")
1539-
}, 500)
1540-
1520+
self._unripe = false;
1521+
logger.info("[准备完成] _unripe")
15411522
}
1523+
1524+
console.groupEnd();
15421525
console.timeEnd("updateGob 耗时")
15431526
logger.groupEnd()
15441527

@@ -1719,7 +1702,7 @@ GobCaryon.prototype.updateGob = _.debounce(async function (disableRender) {
17191702
}
17201703

17211704

1722-
}, 300)
1705+
}
17231706

17241707

17251708
function _objectToObject(object, sameObject, checkMUTI, ignoreNull, asyncCounter)

0 commit comments

Comments
 (0)