private void OnGUI() { GUIStyle style = new GUIStyle(); style.alignment = TextAnchor.MiddleCenter; if (activeFeature is SketchFeatureBase) { var sk = activeFeature as SketchFeatureBase; foreach (var c in sk.GetSketch().constraintList) { if (!(c is ValueConstraint)) { continue; } var constraint = c as ValueConstraint; if (!constraint.valueVisible) { continue; } if (MoveTool.instance.IsConstraintEditing(constraint)) { continue; } var pos = constraint.pos; pos = Camera.main.WorldToScreenPoint(pos); var txt = constraint.GetLabel(); var rect = new Rect(pos.x, Camera.main.pixelHeight - pos.y, 0, 0); style.normal.textColor = Color.black; for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (i == 0 && j == 0) { continue; } GUI.Label(new Rect(rect.x + i, rect.y + j, 0, 0), txt, style); } } if (hovered == c) { style.normal.textColor = canvas.GetStyle("hovered").color; } else if (IsSelected(c)) { style.normal.textColor = canvas.GetStyle("selected").color; } else { style.normal.textColor = Color.white; } GUI.Label(rect, txt, style); } } }
private void OnGUI() { GUIStyle style = new GUIStyle(); style.alignment = TextAnchor.MiddleCenter; if (activeFeature is SketchFeatureBase) { var sk = activeFeature as SketchFeatureBase; foreach (var c in sk.GetSketch().constraintList) { if (!(c is ValueConstraint)) { continue; } if (hovered == c) { style.normal.textColor = canvas.GetStyle("hovered").color; } else { style.normal.textColor = Color.white; } var constraint = c as ValueConstraint; var pos = constraint.pos; pos = Camera.main.WorldToScreenPoint(pos); var txt = Math.Abs(constraint.GetValue()).ToString("0.##"); GUI.Label(new Rect(pos.x, Camera.main.pixelHeight - pos.y, 0, 0), txt, style); } } }