Browse Source

[shgraph] Input focus fix, Small style tweaks

Clément Espeute 1 year ago
parent
commit
f1a9b899e5
6 changed files with 14 additions and 12 deletions
  1. 2 2
      bin/style.css
  2. 2 2
      bin/style.less
  3. 2 1
      hide/comp/SVG.hx
  4. 7 4
      hide/view/GraphEditor.hx
  5. 1 1
      hide/view/shadereditor/Box.hx
  6. 0 2
      hrt/shgraph/nodes/Split.hx

+ 2 - 2
bin/style.css

@@ -2280,7 +2280,7 @@ input[type=checkbox]:checked:after {
 }
 .graph-view .heaps-scene svg .title-box {
   text-anchor: start;
-  fill: #ffffff;
+  fill: #c3c3c3;
   stroke: none;
   user-select: none;
 }
@@ -2309,7 +2309,7 @@ input[type=checkbox]:checked:after {
   fill: #5ca4ab;
 }
 .graph-view .heaps-scene svg .title-node {
-  fill: #ffffff;
+  fill: #c3c3c3;
   stroke: none;
   user-select: none;
 }

+ 2 - 2
bin/style.less

@@ -2574,7 +2574,7 @@ input[type=checkbox] {
 
 			.title-box {
 				text-anchor: start;
-				fill: #ffffff;
+				fill: #c3c3c3;
 				stroke: none;
 				user-select: none;
 				&::selection {
@@ -2615,7 +2615,7 @@ input[type=checkbox] {
 			}
 
 			.title-node {
-				fill: #ffffff;
+				fill: #c3c3c3;
 				stroke: none;
 				user-select: none;
 				&::selection {

+ 2 - 1
hide/comp/SVG.hx

@@ -53,7 +53,8 @@ class SVG extends Component {
 
 		var dx = (x2 - advance) - (x1 + advance);
 		var dy = y2 - y1;
-		var len = hxd.Math.distance(dx, dy);
+		var len = hxd.Math.max(0.001, hxd.Math.distance(dx, dy));
+
 
 		var diagXOffset = dx/len * advance * round;
 		var diagYOffset = dy/len * advance * round;

+ 7 - 4
hide/view/GraphEditor.hx

@@ -705,7 +705,6 @@ class GraphEditor extends hide.comp.Component {
 		if (addMenu?.is(":visible"))
 			return;
 		if (edgeCreationInput != null || edgeCreationOutput != null) {
-			trace("");
 			startUpdateViewPosition();
 			createLink(clientX, clientY);
 			return;
@@ -731,7 +730,6 @@ class GraphEditor extends hide.comp.Component {
 		}
 		// Edit rectangle selection
 		if (startRecSelection != null) {
-			trace("");
 			startUpdateViewPosition();
 			var endRecSelection = new h2d.col.Point(lX(clientX), lY(clientY));
 			var xMin = startRecSelection.x;
@@ -1104,6 +1102,11 @@ class GraphEditor extends hide.comp.Component {
 		elt.get(0).onpointerdown = function(e: js.html.PointerEvent) {
 			if (e.button != 0)
 				return;
+			if ((cast e.target: js.html.Element).closest("foreignObject") != null)
+			{
+				e.stopPropagation();
+				return;
+			}
 			e.stopPropagation();
 
 			if (!box.selected) {
@@ -1114,13 +1117,13 @@ class GraphEditor extends hide.comp.Component {
 				opSelect(box.node.getId(), true, currentUndoBuffer);
 				commitUndo();
 			}
-			//elt.get(0).setPointerCapture(e.pointerId);
+			elt.get(0).setPointerCapture(e.pointerId);
 			beginMove(e);
 		};
 		elt.get(0).onpointerup = function(e: js.html.PointerEvent) {
 			if (e.button != 0)
 				return;
-			//elt.get(0).releasePointerCapture(e.pointerId);
+			elt.get(0).releasePointerCapture(e.pointerId);
 			endMove();
 		};
 		boxes.set(box.node.getId(), box);

+ 1 - 1
hide/view/shadereditor/Box.hx

@@ -277,7 +277,7 @@ class Box {
 		var nodeCircle = editor.editorDisplay.circle(node, 0, nodeHeight, NODE_RADIUS, style).addClass("node input-node");
 
 		var nameWidth = 0.0;
-		if (name.length > 0) {
+		if (name.length > 0 && name != "input") {
 			var inputName = editor.editorDisplay.text(node, NODE_TITLE_PADDING, nodeHeight + 4, name).addClass("title-node");
 			var domName : js.html.svg.GraphicsElement = cast inputName.get()[0];
 			nameWidth = domName.getBBox().width;

+ 0 - 2
hrt/shgraph/nodes/Split.hx

@@ -12,14 +12,12 @@ class Split extends ShaderNodeHxsl {
 		@sgoutput var r : Float;
 		@sgoutput var g : Float;
 		@sgoutput var b : Float;
-		@sgoutput var x : Float;
 		@sgoutput var a : Float;
 		function fragment() {
 			r = rgba.r;
 			g = rgba.g;
 			b = rgba.b;
 			a = rgba.a;
-			x = 0.5;
 		}
 	};