private void SimpleGestures_OnDoubleTap(Vector2 pos) { if (UIManager.FullScreenFadeStack.Count > 0) { return; } var forMe = SimpleGestures.GetUIObjectsUnderPosition(Input.mousePosition).Any(r => r.gameObject == gameObject); if (!forMe) { return; } var nodes = graph.NodesHolder.GetComponentsInChildren <Node>(); foreach (var node in nodes) { if (node.Selected) { EditNode(node); break; } } }
public void OnDragStart(Vector2 pos) { if (UIManager.FullScreenFadeStack.Count > 0) { return; } var anyBaseView = SimpleGestures.GetUIObjectsUnderPosition(SimpleGestures.Instance.LastTouchedMousePos).Any(o => o.gameObject.GetComponent <BaseView>()); if (anyBaseView) { return; } var obj = SimpleGestures.GetUIObjectsUnderPosition(SimpleGestures.Instance.LastTouchedMousePos).FirstOrDefault(o => o.gameObject.GetComponent <IDraggable>() != null); if (obj.gameObject == null) { return; } var view = obj.gameObject.GetComponent <IDraggable>(); if (view == null) { return; } //start drag OnDragStartRaw(pos, view); }
private void SimpleGestures_OnScale(float d) { if (UIManager.FullScreenFadeStack.Count > 0) { return; } var anyBaseView = SimpleGestures.GetUIObjectsUnderPosition(Input.mousePosition).Any(o => o.gameObject.GetComponent <BaseView>()); if (anyBaseView) { return; } var forMe = SimpleGestures.GetUIObjectsUnderPosition(Input.mousePosition).Any(r => r.gameObject == gameObject); if (!forMe) { return; } var ui = SimpleGestures.Instance.LastTouchedUI; if (!ui) { return; } // const float MaxScale = 1.5f; const float MinScale = 0.1f; if (transform.localScale.x > MaxScale && d > 1f) { return; } if (transform.localScale.x < MinScale && d < 1f) { return; } // var obj = new GameObject("", typeof(RectTransform)); obj.transform.SetParent(transform.parent); var rt = obj.transform as RectTransform; //rt.position = Input.mousePosition; rt.position = new Vector2(Screen.width / 2, Screen.height / 2); var parent = transform.parent; transform.SetParent(rt, true); rt.localScale *= ((d - 1) / 2) + 1; transform.SetParent(parent, true); // DestroyImmediate(obj); }
private IAcceptor GetAcceptor() { var uis = SimpleGestures.GetUIObjectsUnderPosition(Input.mousePosition).Select(r => r.gameObject.GetComponent <IAcceptor>()).Where(c => c != null); foreach (var v in uis) { if (v.CanDropIn(dragInfo.View)) { return(v); } } return(null); }
private void SimpleGestures_OnTap(Vector2 pos) { if (UIManager.FullScreenFadeStack.Count > 0) { return; } var forMe = SimpleGestures.GetUIObjectsUnderPosition(Input.mousePosition).Any(r => r.gameObject == gameObject); if (!forMe) { return; } var uis = SimpleGestures.GetUIObjectsUnderPosition(Input.mousePosition).Select(r => r.gameObject).ToArray(); Node selected = default; if (uis.All(ui => ui.GetComponentInParent <UnityEngine.UI.Button>() == null)) { if (uis.Contains(this.gameObject)) { ClearSelected(); var ika = uis.Select(s => s.GetComponent <InputKnobAcceptor>()).FirstOrDefault(s => s != null); if (ika != null) { var knob = ika.GetComponentInParent <InputKnob>(); OnKnobClick(knob); } else { var node = uis.Select(s => s.GetComponent <Node>()).FirstOrDefault(s => s != null); if (node != null) { node.Selected = true; selected = node; //Bus.SetStatusLabel += "Id: " + node.Id.ToString(); } } Bus.SelectedNode.PublishIfChanged(selected); Bus.SelectionChanged += true; } } }
public void OnPinch(SimpleGestures sender, MultiTouchPointerEventData eventData, Vector2 pinchDelta) { LogMultiTouchEvent("OnPinch", eventData, pinchDelta); }
public void OnPan(SimpleGestures sender, MultiTouchPointerEventData eventData, Vector2 delta) { LogMultiTouchEvent("OnPan", eventData, delta); }
public void OnRotate(SimpleGestures sender, MultiTouchPointerEventData eventData, float delta) { LogMultiTouchEvent("OnRotate", eventData, delta); }