Browse Source

PolygonEditor: don't refresh point list during point drag

trethaller 6 years ago
parent
commit
5db6f920cb
1 changed files with 7 additions and 5 deletions
  1. 7 5
      hide/prefab/PolygonEditor.hx

+ 7 - 5
hide/prefab/PolygonEditor.hx

@@ -201,14 +201,14 @@ class PolygonEditor {
 		}));
 		}));
 	}
 	}
 
 
-	function refreshPolygon(){
+	function refreshPolygon(withProps=false) {
 		if(!polygonPrefab.points.isClockwise())
 		if(!polygonPrefab.points.isClockwise())
 			polygonPrefab.points.reverse();  // Ensure poly is always clockwise
 			polygonPrefab.points.reverse();  // Ensure poly is always clockwise
 
 
 		var polyPrim = polygonPrefab.generateCustomPolygon();
 		var polyPrim = polygonPrefab.generateCustomPolygon();
 		var mesh : h3d.scene.Mesh = cast getContext().local3d;
 		var mesh : h3d.scene.Mesh = cast getContext().local3d;
 		mesh.primitive = polyPrim;
 		mesh.primitive = polyPrim;
-		refreshEditorDisplay();
+		refreshEditorDisplay(withProps);
 	}
 	}
 
 
 	function refreshDebugDisplay(){
 	function refreshDebugDisplay(){
@@ -431,6 +431,7 @@ class PolygonEditor {
 			function(e) {
 			function(e) {
 				//lastPos = null;
 				//lastPos = null;
 				lastPointSelected = null;
 				lastPointSelected = null;
+				refreshEditorDisplay();
 				refreshDebugDisplay();
 				refreshDebugDisplay();
 				if( beforeMoveList != null ){
 				if( beforeMoveList != null ){
 					afterMoveList = copyArray(polygonPrefab.points.points);
 					afterMoveList = copyArray(polygonPrefab.points.points);
@@ -458,7 +459,7 @@ class PolygonEditor {
 					}
 					}
 					refreshMovablePoints();
 					refreshMovablePoints();
 					refreshSelectedEdge(new h2d.col.Point(finalPos.x, finalPos.y));
 					refreshSelectedEdge(new h2d.col.Point(finalPos.x, finalPos.y));
-					refreshPolygon();
+					refreshPolygon(false);
 					lastPos = finalPos.clone();
 					lastPos = finalPos.clone();
 				}
 				}
 				else
 				else
@@ -530,16 +531,17 @@ class PolygonEditor {
 		}
 		}
 	}
 	}
 
 
-	function refreshEditorDisplay(){
+	function refreshEditorDisplay(withProps=true) {
 		lineGraphics.clear();
 		lineGraphics.clear();
 		clearMovablePoints();
 		clearMovablePoints();
-		refreshPointList(editContext.getCurrentProps(polygonPrefab));
 		if(polygonPrefab.points == null || polygonPrefab.points.length == 0) return;
 		if(polygonPrefab.points == null || polygonPrefab.points.length == 0) return;
 		lineGraphics.moveTo(polygonPrefab.points[polygonPrefab.points.length - 1].x, polygonPrefab.points[polygonPrefab.points.length - 1].y, 0);
 		lineGraphics.moveTo(polygonPrefab.points[polygonPrefab.points.length - 1].x, polygonPrefab.points[polygonPrefab.points.length - 1].y, 0);
 		for(p in polygonPrefab.points)
 		for(p in polygonPrefab.points)
 			lineGraphics.lineTo(p.x, p.y, 0);
 			lineGraphics.lineTo(p.x, p.y, 0);
 		createMovablePoints();
 		createMovablePoints();
 		refreshMovablePoints();
 		refreshMovablePoints();
+		if(withProps)
+			refreshPointList(editContext.getCurrentProps(polygonPrefab));
 	}
 	}
 
 
 	public function addProps( ctx : EditContext ){
 	public function addProps( ctx : EditContext ){