private void OnMouseUp(MouseUpEvent e) { if (this.m_Active && base.CanStopManipulation(e)) { this.m_GraphView.Remove(this.m_FreehandElement); this.m_FreehandElement.points.Add(e.localMousePosition); List <ISelectable> selection = this.m_GraphView.selection; List <ISelectable> newSelection = new List <ISelectable>(); this.m_GraphView.graphElements.ForEach(delegate(GraphElement element) { if (element.IsSelectable()) { for (int i = 1; i < this.m_FreehandElement.points.Count; i++) { Vector2 vector = this.m_GraphView.ChangeCoordinatesTo(element, this.m_FreehandElement.points[i - 1]); Vector2 vector2 = this.m_GraphView.ChangeCoordinatesTo(element, this.m_FreehandElement.points[i]); float num = Mathf.Min(vector.x, vector2.x); float num2 = Mathf.Max(vector.x, vector2.x); float num3 = Mathf.Min(vector.y, vector2.y); float num4 = Mathf.Max(vector.y, vector2.y); Rect rectangle = new Rect(num, num3, num2 - num + 1f, num4 - num3 + 1f); if (element.Overlaps(rectangle)) { newSelection.Add(element); break; } } } }); foreach (ISelectable current in newSelection) { if (!selection.Contains(current)) { this.m_GraphView.AddToSelection(current); } } if (e.shiftKey) { this.m_GraphView.DeleteSelection(); } this.m_Active = false; base.target.ReleaseMouseCapture(); e.StopPropagation(); } }
protected override bool OnMouseUp(MouseUpEvent e) { // don't do anything until the last button is released. if (!HasFocus || e.HasAnyButtonPressed) { return(base.OnMouseUp(e)); } if (bindTarget.IsHovered) { finalise(); } else { updateBindTarget(); } return(true); }
protected override bool OnMouseUp(MouseUpEvent e) { if (!e.IsPressed(MouseButton.Left) && !e.IsPressed(MouseButton.Right)) { activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); activeCursor.ScaleTo(1, 500, Easing.OutElastic); } if (e.Button == MouseButton.Left) { if (dragRotationState == DragRotationState.Rotating) { activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf); } dragRotationState = DragRotationState.NotDragging; } return(base.OnMouseUp(e)); }
private void OnClickUnitSVItem(MouseUpEvent evt, Unit userArgs) { if (mSelectUnit != null) { if (mSelectUnit.Tag == userArgs.Tag) { return; } var selectIndex = UnitCfg.Instance.FindIndex(mSelectUnit.Tag); var selectItem = mUnitSVItems[selectIndex]; selectItem.style.backgroundColor = Color.clear; } mSelectUnit = userArgs; var curIndex = UnitCfg.Instance.FindIndex(mSelectUnit.Tag); var item = mUnitSVItems[curIndex]; item.style.backgroundColor = Color.gray; }
void OnMouseUp(MouseUpEvent e) { if (!m_Active) { return; } Vector2 mousePosition = e.mousePosition; if (Mathf.Abs(mousePosition.x - m_ActivationPosition.x) < k_ActivationPositionThreshold && Mathf.Abs(mousePosition.y - m_ActivationPosition.y) < k_ActivationPositionThreshold) { m_OnMouseUp.Invoke(); } m_Active = false; e.StopPropagation(); }
void SelectItemOnSingleClick(MouseUpEvent evt) { // TODO: ListView right now does not allow selecting a single // item that is already part of multi-selection, and having // only that item selected. Clicking on any already-selected // item in ListView does nothing. This needs to be fixed in trunk. // // In the meantime, we use this leaked mouse click hack, which // also accounts for another bug in ListView, to catch these // unhandled selection events and do the single-item selection // ourselves. // // See: https://unity3d.atlassian.net/browse/UIT-1011 if (m_Selection.selectionCount <= 1) { return; } if (evt.modifiers.HasFlag(EventModifiers.Control) || evt.modifiers.HasFlag(EventModifiers.Shift) || evt.modifiers.HasFlag(EventModifiers.Command)) { return; } var element = evt.target as VisualElement; var ancestor = element is BuilderExplorerItem ? element as BuilderExplorerItem : element?.GetFirstAncestorOfType <BuilderExplorerItem>(); if (ancestor == null) { return; } var documentElement = ancestor.GetProperty(BuilderConstants.ElementLinkedDocumentVisualElementVEPropertyName) as VisualElement; if (documentElement == null) { return; } m_Selection.Select(null, documentElement); }
void OnClickEvent(EventBase evt) { if (evt.eventTypeId == MouseUpEvent.TypeId()) { var ce = (IMouseEvent)evt; if (ce.button == (int)MouseButton.LeftMouse) { ToggleValue(); } } else if (evt.eventTypeId == PointerUpEvent.TypeId() || evt.eventTypeId == ClickEvent.TypeId()) { var ce = (IPointerEvent)evt; if (ce.button == (int)MouseButton.LeftMouse) { ToggleValue(); } } }
protected void OnMouseUp(MouseUpEvent e) { GraphElement ce = e.target as GraphElement; if (ce != null && !ce.IsPositioned()) { return; } if (m_Active) { if (CanStopManipulation(e)) { m_Active = false; target.ReleaseMouse(); e.StopPropagation(); } } }
internal static void RightClickFieldMenuEvent(MouseUpEvent evt) { if (evt.button != (int)MouseButton.RightMouse) { return; } var element = evt.target as VisualElement; if (element == null) { return; } var property = element.userData as SerializedProperty; if (property == null) { return; } var wasEnabled = GUI.enabled; if (!element.enabledInHierarchy) { GUI.enabled = false; } var menu = EditorGUI.FillPropertyContextMenu(property); GUI.enabled = wasEnabled; var menuPosition = new Vector2(element.layout.xMin, element.layout.height); menuPosition = element.LocalToWorld(menuPosition); var menuRect = new Rect(menuPosition, Vector2.zero); menu.DropDown(menuRect); evt.PreventDefault(); evt.StopPropagation(); }
protected override bool OnMouseUp(MouseUpEvent e) { var mouseDownPosition = e.ScreenSpaceMouseDownPosition; var nowPosition = e.ScreenSpaceMousePosition; var movingPosition = nowPosition - mouseDownPosition; var deltaPosition = nowPosition - e.ScreenSpaceMousePosition;//TODO : last position if (_moveDirection == Vector2.Zero) //tap mode { TapConfig tapConfig; if (MobileScrollAnixConfig.Value.TagConfigs.TryGetValue(TouchScreenTapInteractive.SingleTap, out tapConfig)) { OnTap(tapConfig); } } else //scroll mode { if (_moveDirection.X != 0) { SingleAnixConfig singleAnixConfig; if (MobileScrollAnixConfig.Value.ScrollConfigs.TryGetValue(TouchScreenScrollInteractive.XAnix, out singleAnixConfig)) { OnScroll(singleAnixConfig, false, deltaPosition.X, movingPosition.X); } } else if (_moveDirection.Y != 0) { SingleAnixConfig singleAnixConfig; if (MobileScrollAnixConfig.Value.ScrollConfigs.TryGetValue(TouchScreenScrollInteractive.YAnix, out singleAnixConfig)) { OnScroll(singleAnixConfig, false, deltaPosition.Y, movingPosition.Y); } } } //clear direction _moveDirection = Vector2.Zero; _timer.Stop(); return(base.OnMouseUp(e)); }
//!Ustawia typ ścieżki fabularnej wyboru. private void setNarrativePath(MouseUpEvent e, ChoiceData choiceData) { Toggle narrativeType = (Toggle)e.target; if (narrativeType.value) { choiceData.Path = (NarrativePath)Enum.Parse(typeof(NarrativePath), narrativeType.text); foreach (Toggle toggle in narrativeTypeToggles) { if (toggle != narrativeType) { toggle.value = false; } } } else { narrativeType.value = true; } }
private void OnMouseUp(MouseUpEvent e) { GraphElement graphElement = base.parent as GraphElement; if (graphElement != null) { if (graphElement.IsResizable()) { if (this.m_Active) { if (e.button == (int)this.activateButton && this.m_Active) { this.m_Active = false; this.ReleaseMouseCapture(); e.StopPropagation(); } } } } }
// 'Load' is pressed. void OnLoad(MouseUpEvent e) { // Let the user select a file. var fullFilePath = EditorUtility.OpenFilePanel("Load Python Script", "", "py"); // Verify that the resulting file string is not empty (in case the user hit 'cancel'). If it is, return. if (string.IsNullOrEmpty(fullFilePath)) { return; } // Once a file has been chosen, clear the console's current content. OnClearCode(e); // Read and copy the file's content var code = System.IO.File.ReadAllText(fullFilePath); // And set the text area to it. SetCode(code); }
void OnMouseUp(MouseUpEvent evt) { bool emitDragFinishedEvent = m_Active; m_Active = false; if (m_Handle.HasMouseCapture()) { m_Handle.ReleaseMouseCapture(); } evt.StopImmediatePropagation(); m_WindowDockingLayout.CalculateDockingCornerAndOffset(target.layout, target.parent.layout); if (emitDragFinishedEvent && OnDragFinished != null) { OnDragFinished(); } }
void OnMouseUp(MouseUpEvent evt) { bool emitDragFinishedEvent = m_Active; m_Active = false; if (target.HasMouseCapture()) { target.ReleaseMouseCapture(); } evt.StopPropagation(); RefreshDocking(); if (emitDragFinishedEvent && OnDragFinished != null) { OnDragFinished(); } }
bool ProcessClick(EventBase evt) { if (evt.eventTypeId == MouseUpEvent.TypeId()) { var ce = (IMouseEvent)evt; if (ce.button == (int)MouseButton.LeftMouse) { return(true); } } else if (evt.eventTypeId == PointerUpEvent.TypeId() || evt.eventTypeId == ClickEvent.TypeId()) { var ce = (IPointerEvent)evt; if (ce.button == (int)MouseButton.LeftMouse) { return(true); } } return(false); }
void OnMouseUp(MouseUpEvent evt) { var target = evt.currentTarget as VisualElement; if (!target.HasMouseCapture() || !m_WeStartedTheDrag) { return; } if (!CanStopManipulation(evt)) { return; } DisplayContextMenu(evt, target); target.ReleaseMouse(); m_WeStartedTheDrag = false; evt.StopPropagation(); }
protected void OnMouseUp(MouseUpEvent evt) { if (base.CanStopManipulation(evt)) { base.target.ReleaseMouseCapture(); if (this.IsRepeatable()) { if (this.m_Repeater != null) { this.m_Repeater.Pause(); } } else if (this.clicked != null && base.target.ContainsPoint(evt.localMousePosition)) { this.clicked(); } base.target.pseudoStates &= ~PseudoStates.Active; evt.StopPropagation(); } }
void OnItemMouseUp(MouseUpEvent evt) { if (evt.clickCount != 1) { return; } if (evt.modifiers != EventModifiers.None || evt.button != (int)MouseButton.RightMouse) { return; } if (OnItemContextMenu != null) { var item = (T)evt.currentTarget; OnItemContextMenu.Invoke(item); } evt.StopImmediatePropagation(); }
void OnMouseUp(MouseUpEvent evt) { if (evt.button != 0) { return; } if (!textInputField.HasMouseCapture()) { return; } textInputField.SyncTextEngine(); m_Changed = false; if (m_Dragged && m_DragToPosition) { editorEngine.MoveSelectionToAltCursor(); } else if (m_PostponeMove) { editorEngine.MoveCursorToPosition_Internal(evt.localMousePosition, evt.shiftKey); } else if (m_SelectAllOnMouseUp) { m_SelectAllOnMouseUp = false; } editorEngine.MouseDragSelectsWholeWords(false); textInputField.ReleaseMouseCapture(); m_DragToPosition = true; m_Dragged = false; m_PostponeMove = false; evt.StopPropagation(); // Scroll offset might need to be updated editorEngine.UpdateScrollOffset(); }
public override void DisplayMenuIfEventMatches(EventBase evt, IEventHandler eventHandler) { if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer) { if (evt.GetEventTypeId() == MouseDownEvent.TypeId()) { MouseDownEvent e = evt as MouseDownEvent; if (e.button == (int)MouseButton.RightMouse || (e.button == (int)MouseButton.LeftMouse && e.modifiers == EventModifiers.Control)) { DisplayMenu(evt, eventHandler); evt.StopPropagation(); return; } } } else { if (evt.GetEventTypeId() == MouseUpEvent.TypeId()) { MouseUpEvent e = evt as MouseUpEvent; if (e.button == (int)MouseButton.RightMouse) { DisplayMenu(evt, eventHandler); evt.StopPropagation(); return; } } } if (evt.GetEventTypeId() == KeyUpEvent.TypeId()) { KeyUpEvent e = evt as KeyUpEvent; if (e.keyCode == KeyCode.Menu) { DisplayMenu(evt, eventHandler); evt.StopPropagation(); } } }
protected void OnMouseUp(MouseUpEvent e) { /* * IDraggable ce = e.target as IDraggable; * if (ce == null || !ce.IsMovableNow()) * { * return; * } */ if (m_Active) { if (CanStopManipulation(e)) { //ce.UpdatePresenterPosition(); m_Active = false; target.ReleaseMouse(); e.StopPropagation(); } } }
public override void DisplayMenuIfEventMatches(EventBase evt, IEventHandler eventHandler) { if (evt.GetEventTypeId() == MouseUpEvent.TypeId()) { MouseUpEvent e = evt as MouseUpEvent; if (e.button == (int)MouseButton.RightMouse) { DisplayMenu(evt, eventHandler); evt.StopPropagation(); } } else if (evt.GetEventTypeId() == KeyUpEvent.TypeId()) { KeyUpEvent e = evt as KeyUpEvent; if (e.keyCode == KeyCode.Menu) { DisplayMenu(evt, eventHandler); evt.StopPropagation(); } } }
protected virtual void OnMouseUp(MouseUpEvent e) { if (!active || !CanStopManipulation(e)) { return; } if (CanPerformConnection(e.localMousePosition)) { edgeDragHelper.HandleMouseUp(e); } else { Abort(); } active = false; edgeCandidate = null; target.ReleaseMouse(); e.StopPropagation(); }
protected virtual void OnMouseUp(MouseUpEvent e) { if (!m_Active || !target.HasMouseCapture() || !CanStopManipulation(e)) { return; } m_Active = false; //uPixel.FlushBuffer(); pixelOp.positions = uPixel.GetBrush(); pixelOp.value = (byte)uPixel.paletteIndex; pixelOp.frame = uPixel.pixelAsset.FrameIndex; if (pixelOp.positions.Count > 0) { uPixel.pixelAsset.DoCanvasOperation(pixelOp); uPixel.m_HistoryCache.ClearCache(uPixel.pixelAsset.GetHistoryLength() - 1); pixelOp = new uPixelCanvasOp(); } uPixel.RefreshInspector(); target.ReleaseMouse(); e.StopPropagation(); }
public override void DisplayMenuIfEventMatches(EventBase evt, IEventHandler eventHandler) { if (evt.GetEventTypeId() == EventBase <MouseUpEvent> .TypeId()) { MouseUpEvent mouseUpEvent = evt as MouseUpEvent; if (mouseUpEvent.button == 1) { base.DisplayMenu(evt, eventHandler); evt.StopPropagation(); } } else if (evt.GetEventTypeId() == EventBase <KeyUpEvent> .TypeId()) { KeyUpEvent keyUpEvent = evt as KeyUpEvent; if (keyUpEvent.keyCode == KeyCode.Menu) { base.DisplayMenu(evt, eventHandler); evt.StopPropagation(); } } }
private void TemplatesClick(MouseUpEvent evt) { if (evt.propagationPhase != PropagationPhase.AtTarget) { return; } var menu = new GenericMenu(); menu.AddItem(new GUIContent("Simple"), false, obj => CreateTemplate("Simple"), null); menu.AddItem(new GUIContent("Function"), false, obj => CreateTemplate("Function"), null); menu.AddItem(new GUIContent("Custom Type View"), false, obj => CreateTemplate("Custom Type View"), null); menu.AddItem(new GUIContent("Custom Expandable Type View"), false, obj => CreateTemplate("Custom Expandable Type View"), null); var menuPosition = new Vector2(TemplatesDropdown.layout.xMin, TemplatesDropdown.layout.center.y); menuPosition = this.LocalToWorld(menuPosition); var menuRect = new Rect(menuPosition, Vector2.zero); menu.DropDown(menuRect); }
protected override void OnMouseUp(MouseUpEvent e) { if (!e.HasAnyButtonPressed) { activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); activeCursor.ScaleTo(1, 500, Easing.OutElastic); if (dragRotationState != DragRotationState.NotDragging) { activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf); dragRotationState = DragRotationState.NotDragging; } if (State.Value == Visibility.Visible) { playTapSample(0.8); } } base.OnMouseUp(e); }
protected override bool OnMouseUp(MouseUpEvent e) { scaleContainer.ScaleTo(1, 500, Easing.OutElastic); // only trigger the event if we are inside the area of the button if (Contains(e.ScreenSpaceMousePosition)) { switch (e.Button) { case MouseButton.Left: SelectNext(1); break; case MouseButton.Right: SelectNext(-1); break; } } return(true); }
void OnMouseUp(MouseUpEvent e) { if (!active) { return; } if (CanStopManipulation(e)) { target.ReleaseMouse(); e.StopPropagation(); GraphView graphView = elem.GetFirstAncestorOfType <GraphView>(); if (graphView != null && graphView.elementResized != null) { graphView.elementResized(elem); } } active = false; }