Browse Source

修改画墙重复点击BUG

zhibin 6 years ago
parent
commit
e36f2785a3
2 changed files with 19 additions and 9 deletions
  1. 18 9
      libs/Controls/Pan.js
  2. 1 0
      libs/Controls/Select.js

+ 18 - 9
libs/Controls/Pan.js

@@ -118,14 +118,13 @@ Pan.prototype.startPan = (function() {
 					this.f_draggingStairCorner = this.currentState.selectStairSet.type == 0; // 当前选择楼梯角
 					this.f_draggingStairLine = this.currentState.selectStairSet.type == 0; // 当前选择楼梯面
 				}
-
-				// this.f_draggingBackGround = true;
+				
+				this.currentState.currentWallId
 			}
 
-			console.log(this.currentState.selectWallSet)
+
 			//当前选择墙面
 			if (this.currentState.selectWallSet != null && this.currentState.selectWallSet.type == 1) {
-				this.f_draggingBackGround = false;
 				this.f_draggingWallLine = true;
 				this.f_draggingWallCorner = false;
 
@@ -163,6 +162,15 @@ Pan.prototype.startPan = (function() {
 	}
 
 	return function (e) {
+		if (!(this.__firstbuildwallState && !this.build.buildwallState) && !this.__updateCurrentState) {
+			this.lastX = e.offsetX;
+			this.lastY = e.offsetY;
+			this.pan(e, true)
+		}
+		this.__firstbuildwallState = this.build.buildwallState
+
+		this.__updateCurrentState = false
+		
 		for (var key in strategy) {
 			strategy[key] = strategy[key].bind(this)
 		}
@@ -241,6 +249,7 @@ Pan.prototype.pan = function () {
 		},
 		// 拖拽墙面的角度
 		f_draggingWallCorner: function (args) {
+			// this.currentState.currentWallId = this.currentState.selectWallSet.id;
 			this.move.moveWallcorner(
 				this.currentState.selectWallSet.id,
 				this.currentState.currentstartlinePointIndex, 
@@ -274,6 +283,7 @@ Pan.prototype.pan = function () {
 
 		// 其余设置都经过
 		__default: function (args) {
+
 			if (this.f_buildingWall || this.f_buildingPartition) { //修墙
 				this.build.buildwallState = 1;
 				this.layer.build.BuildingWall(args.point);
@@ -297,6 +307,7 @@ Pan.prototype.pan = function () {
 				
 				//当前点是否在墙上
 				this.currentState.selectWallSet = this.calculateElement.wallsContain(args.point);
+				this.__updateCurrentState = true
 
 				this.currentState.selectWallSet ?
 					strategy.__selectWallSet(args) : 
@@ -447,11 +458,11 @@ Pan.prototype.pan = function () {
 		}
 	}
 
-	return function (e) {
+	return function (e, force) {
 		for (var key in strategy) {
 			strategy[key] = strategy[key].bind(this)
 		}
-
+		
 		if (this.layer.control.draggingDialog) {
 			return
 		}
@@ -465,7 +476,7 @@ Pan.prototype.pan = function () {
 			wallid: this.currentState.currentWallId
 		}
 
-		if (args.dx == 0 && args.dy == 0) {
+		if (!force && (args.dx == 0 && args.dy == 0)) {
 			return CanvasSketch.stopEventBubble(e);
 		}
 
@@ -473,11 +484,9 @@ Pan.prototype.pan = function () {
 		this.lastPoint = this.layer.getPositionFromPx(
 			{ x: this.lastX, y: this.lastY }
 		);
-
 		// 更新位置
 		this.lastX = offsetX;
 		this.lastY = offsetY;
-		
 		for (var i = 0, keys = Object.keys(strategy); i < keys.length; i++) {
 			if (this[keys[i]]) {
 				strategy[keys[i]](args);

+ 1 - 0
libs/Controls/Select.js

@@ -203,6 +203,7 @@ Select.prototype.endselectSpiralPlane=function()
 //选择墙角
 Select.prototype.selectWallCorner=function(wallid,index)
 {
+	console.log('----0')
 	this.currentState.currentWallId = wallid;
 	var point=this.layer.vectors[wallid].geometry.points[index];
 	var r=this.layer.parameter.wallThickness;