protected void OnMouseDown(MouseDownEvent e) { if (m_Active) { e.StopImmediatePropagation(); return; } if (!CanStartManipulation(e)) { return; } var graphView = target as GraphView; if (graphView == null) { return; } m_Start = graphView.ChangeCoordinatesTo(graphView.contentViewContainer, e.localMousePosition); m_Active = true; target.TakeMouseCapture(); e.StopImmediatePropagation(); }
private void OnMouseDown(MouseDownEvent e) { if (m_Active) { e.StopImmediatePropagation(); return; } var graphView = target as GraphView; if (graphView == null) { return; } if (CanStartManipulation(e)) { if (!e.actionKey) { graphView.ClearSelection(); } graphView.Add(m_Rectangle); m_Rectangle.start = e.localMousePosition; m_Rectangle.end = m_Rectangle.start; m_Active = true; target.CaptureMouse(); // We want to receive events even when mouse is not over ourself. e.StopImmediatePropagation(); } }
void OnMouseDown(MouseDownEvent evt) { if (!CanStartManipulation(evt)) { return; } var target = evt.currentTarget as VisualElement; var stopEvent = StopEventOnMouseDown(); if (stopEvent) { evt.StopImmediatePropagation(); } if (target.HasMouseCapture()) { if (!stopEvent) { evt.StopImmediatePropagation(); } return; } m_Start = evt.mousePosition; m_WeStartedTheDrag = true; target.CaptureMouse(); }
protected void OnMouseDown(MouseDownEvent e) { if (m_Active) { e.StopImmediatePropagation(); return; } if (CanStartManipulation(e)) { // Ignore double-click to allow text editing of the selected element if (e.clickCount == 2) { return; } m_StartDrag(target); m_Start = e.mousePosition; m_Active = true; target.CaptureMouse(); e.StopPropagation(); target.AddToClassList(s_ActiveHandleClassName); } }
private void OnMouseDown(MouseDownEvent e) { if (m_Active) { e.StopImmediatePropagation(); return; } if (e.target != target) { return; } if (CanStartManipulation(e)) { m_GraphView.ClearSelection(); m_GraphView.Add(m_FreehandElement); m_FreehandElement.points.Clear(); m_FreehandElement.points.Add(e.localMousePosition); m_FreehandElement.deleteModifier = e.shiftKey; m_Active = true; target.TakeMouseCapture(); e.StopPropagation(); } }
protected void OnMouseDown(MouseDownEvent evt) { if (evt != null && CanStartManipulation(evt)) { active = true; target.CaptureMouse(); lastMousePosition = evt.localMousePosition; if (IsRepeatable()) { // Repeatable button clicks are performed on the MouseDown and at timer events if (target.ContainsPoint(evt.localMousePosition)) { Invoke(evt); } if (m_Repeater == null) { m_Repeater = target.schedule.Execute(OnTimer).Every(m_Interval).StartingIn(m_Delay); } else { m_Repeater.ExecuteLater(m_Delay); } } target.pseudoStates |= PseudoStates.Active; evt.StopImmediatePropagation(); } }
void ExpandOrCollapse(MouseDownEvent evt) { if (!(evt.target is VisualElement expanderLabel)) { return; } VisualElement itemElement = expanderLabel.GetFirstAncestorOfType <TemplateContainer>(); if (!(itemElement?.userData is SearcherItem item) || !item.HasChildren || !expanderLabel.ClassListContains("Expanded") && !expanderLabel.ClassListContains("Collapsed")) { return; } if (!m_ExpandedResults.Contains(item)) { Expand(item); } else { Collapse(item); } evt.StopImmediatePropagation(); }
void OnMouseDown(MouseDownEvent evt) { if (evt.button != (int)MouseButton.LeftMouse) { return; } if (m_Grabbed) { return; } #if UNITY_2018_3_OR_NEWER this.CaptureMouse(); #else this.TakeMouseCapture(); #endif m_Grabbed = true; m_GrabbedMousePosition = evt.mousePosition; #if UNITY_2019_1_OR_NEWER m_ElementOriginalWidth = m_AffectedElement.resolvedStyle.width; #else m_ElementOriginalWidth = m_AffectedElement.style.width; #endif evt.StopImmediatePropagation(); }
private void OnMouseDown(MouseDownEvent e) { if (this.m_Active) { e.StopImmediatePropagation(); } else if (!MouseCaptureController.IsMouseCaptureTaken()) { GraphElement graphElement = base.parent as GraphElement; if (graphElement != null) { if (graphElement.IsResizable()) { if (e.button == (int)this.activateButton) { this.m_Start = this.ChangeCoordinatesTo(base.parent, e.localMousePosition); this.m_StartPos = base.parent.layout; if (base.parent.style.positionType != PositionType.Manual) { Debug.LogWarning("Attempting to resize an object with a non manual position"); } this.m_Active = true; this.TakeMouseCapture(); e.StopPropagation(); } } } } }
protected void OnMouseDown(MouseDownEvent e) { if (m_Active) { e.StopImmediatePropagation(); return; } /* * IDraggable ce = e.target as IDraggable; * if (ce == null || !ce.IsMovableNow()) * { * return; * } */ if (CanStartManipulation(e)) { m_Start = e.localMousePosition; m_Active = true; target.CaptureMouse(); e.StopPropagation(); } }
void OnItemMouseDown(MouseDownEvent evt) { if (evt.clickCount != 1) { return; } if (evt.button != (int)MouseButton.LeftMouse && evt.button != (int)MouseButton.RightMouse) { return; } var item = (T)evt.currentTarget; if (evt.modifiers == EventModifiers.None) { var alreadySelected = selection == item; if (evt.button == (int)MouseButton.LeftMouse && alreadySelected) { if (HasFocus() && OnItemRename != null) { OnItemRename.Invoke(item); } } else { selection = item; } } evt.StopImmediatePropagation(); }
private void OnMouseDown(MouseDownEvent e) { if (this.m_Active) { e.StopImmediatePropagation(); } else { GraphView graphView = base.target as GraphView; if (graphView != null) { if (base.CanStartManipulation(e)) { if (!e.shiftKey) { graphView.ClearSelection(); } graphView.Add(this.m_Rectangle); this.m_Rectangle.start = e.localMousePosition; this.m_Rectangle.end = this.m_Rectangle.start; this.m_Active = true; base.target.TakeMouseCapture(); e.StopPropagation(); } } } }
private void OnMouseDown(MouseDownEvent e) { if (m_ReadyToDrag) { e.StopImmediatePropagation(); return; } if (e.button != 0 || e.commandKey || e.altKey || e.ctrlKey || e.shiftKey) { return; } m_ReadyToDrag = true; this.CaptureMouse(); e.StopImmediatePropagation(); }
void OnMouseDown(MouseDownEvent evt) { if (m_Active) { evt.StopImmediatePropagation(); return; } if (m_ParameterElement.ConfigEditor.FilterString != string.Empty) { return; } m_ParameterContainer = target.parent; m_DragBar = new ParameterDragBar(); m_DragBar.style.width = new StyleLength(m_ParameterContainer.resolvedStyle.width); target.parent.Add(m_DragBar); m_Offset = m_DragHandle.worldBound.position.y - m_ParameterContainer.worldBound.position.y; m_DragBar.style.top = evt.localMousePosition.y + m_Offset; m_Active = true; m_DragHandle.CaptureMouse(); evt.StopPropagation(); }
protected void OnMouseDown(MouseDownEvent evt) { if (m_Active) { evt.StopImmediatePropagation(); return; } if (!CanStartManipulation(evt)) { return; } m_Edge = (evt.target as VisualElement).parent as Edge; if (m_Edge != null) { m_EdgePresenter = m_Edge.GetPresenter <EdgePresenter>(); } m_PressPos = evt.mousePosition; target.TakeMouseCapture(); evt.StopPropagation(); m_LastMouseDownEvent = evt; }
protected void OnMouseDown(MouseDownEvent e) { if (m_Active) { e.StopImmediatePropagation(); return; } m_Active = false; m_Dragging = false; m_AddedByMouseDown = false; if (target == null) { return; } selectionContainer = target.GetFirstAncestorOfType <ISelection>(); if (selectionContainer == null) { return; } selectedElement = target.GetFirstOfType <GraphElement>(); if (selectedElement == null) { return; } // Since we didn't drag after all, update selection with current element only if (!selectionContainer.selection.Contains(selectedElement)) { if (!e.ctrlKey) { selectionContainer.ClearSelection(); } selectionContainer.AddToSelection(selectedElement); m_AddedByMouseDown = true; } if (e.button == (int)activateButton) { // avoid starting a manipulation on a non movable object if (!selectedElement.IsDroppable()) { return; } // Reset drag and drop m_DragAndDropDelay.Init(e.localMousePosition); m_Active = true; target.TakeMouseCapture(); e.StopPropagation(); } }
void OnMouseDown(MouseDownEvent evt) { m_Active = true; m_LocalMosueOffset = m_Handle.WorldToLocal(evt.mousePosition); m_Handle.TakeMouseCapture(); evt.StopImmediatePropagation(); }
/// <summary> /// Callback for the MouseDown event. /// </summary> /// <param name="e">The event.</param> protected void OnMouseDown(MouseDownEvent e) { if (m_Active) { e.StopImmediatePropagation(); return; } m_Active = false; m_Dragging = false; m_AddedByMouseDown = false; if (target == null) { return; } m_SelectionContainer = target.GetFirstAncestorOfType <IDragSource>(); if (m_SelectionContainer == null) { // Keep for potential later use in OnMouseUp (where e.target might be different then) m_SelectionContainer = target.GetFirstOfType <IDragSource>(); m_SelectedElement = e.target as GraphElement; return; } m_SelectedElement = target.GetFirstOfType <GraphElement>(); if (m_SelectedElement == null) { return; } // Since we didn't drag after all, update selection with current element only if (!m_SelectedElement.IsSelected()) { var selectionMode = e.actionKey ? SelectElementsCommand.SelectionMode.Add : SelectElementsCommand.SelectionMode.Replace; m_SelectedElement.CommandDispatcher.Dispatch(new SelectElementsCommand(selectionMode, m_SelectedElement.Model)); m_AddedByMouseDown = true; } if (e.button == (int)m_ActivateButton) { // avoid starting a manipulation on a non movable object if (!m_SelectedElement.Model.IsDroppable()) { return; } m_MouseDownPosition = e.localMousePosition; m_Active = true; target.CaptureMouse(); e.StopPropagation(); } }
private void OnMouseDown(MouseDownEvent e) { if (m_Active) { e.StopImmediatePropagation(); return; } if (!CanStartManipulation(e)) { return; } m_OriginalPosition = e.mousePosition; m_Active = true; target.CaptureMouse(); e.StopImmediatePropagation(); }
void OnMouseDownEvent(MouseDownEvent e) { if ((e.clickCount == 2) && e.button == (int)MouseButton.LeftMouse && IsRenamable()) { OpenTextEditor(); e.PreventDefault(); e.StopImmediatePropagation(); } }
public void OnMouseDown(MouseDownEvent e) { if (m_Active) { e.StopImmediatePropagation(); } else if (e.button != 1 && CanStartManipulation(e)) { GraphView graphView = target as GraphView; if (graphView != null) { m_Start = graphView.ChangeCoordinatesTo(graphView.contentViewContainer, e.localMousePosition); m_Active = true; target.CaptureMouse(); e.StopImmediatePropagation(); } } }
void OnMouseDown(MouseDownEvent evt) { active = true; offset = evt.mousePosition - (Vector2)target.transform.position; handle.CaptureMouse(); evt.StopImmediatePropagation(); }
void OnMouseDown(MouseDownEvent evt) { if (CanStartManipulation(evt)) { m_Panning = true; m_ActivatingButton = evt.button; target.CaptureMouse(); evt.StopImmediatePropagation(); } }
void OnMouseDown(MouseDownEvent evt) { if (s_CurrentlyActiveBuilderDragger != null && s_CurrentlyActiveBuilderDragger != this) { return; } var target = evt.currentTarget as VisualElement; if (m_WeStartedTheDrag && target.HasMouseCapture()) { evt.StopImmediatePropagation(); evt.PreventDefault(); return; } if (!CanStartManipulation(evt)) { return; } var stopEvent = StopEventOnMouseDown(evt); if (stopEvent) { evt.StopImmediatePropagation(); } if (target.HasMouseCapture()) { if (!stopEvent) { evt.StopImmediatePropagation(); } return; } s_CurrentlyActiveBuilderDragger = this; m_Start = evt.mousePosition; m_WeStartedTheDrag = true; target.CaptureMouse(); }
void OnMouseDown(MouseDownEvent evt) { if (CanStartManipulation(evt)) { m_Zooming = true; m_PressPos = evt.localMousePosition; m_LastZoomPos = m_PressPos; target.CaptureMouse(); evt.StopImmediatePropagation(); } }
private void OnMouseDown(MouseDownEvent evt) { if (_active) { evt.StopImmediatePropagation(); return; } if (CanStartManipulation(evt)) { _active = true; target.CaptureMouse(); _start = evt.localMousePosition; withActiveFilters(f => { if (f.OnDown != null) { f.OnDown(evt); } }); evt.StopImmediatePropagation(); } }
protected void OnMouseDown(MouseDownEvent evt) { if (!CanStartManipulation(evt)) { return; } if (m_Active) { evt.StopImmediatePropagation(); } }
void OnMouseDown(MouseDownEvent e) { if (m_Active) { e.StopImmediatePropagation(); return; } if (MouseCaptureController.IsMouseCaptureTaken()) { return; } var ce = parent as GraphElement; if (ce == null) { return; } if (!((StoryNode)ce).expanded) { return; } // if (!ce.IsResizable()) // return; if (e.button == (int)ActivateButton) { m_Start = this.ChangeCoordinatesTo(parent, e.localMousePosition); m_StartPos = parent.layout; // Warn user if target uses a relative CSS position type // if (parent.style.positionType != PositionType.Manual) // { // if (parent.style.positionType == PositionType.Absolute) // { // if (!(parent.style.flexDirection == FlexDirection.Column || parent.style.flexDirection == FlexDirection.Row)) // { // Debug.LogWarning("Attempting to resize an object with an absolute position but no layout direction (row or column)"); // } // } // else // { // Debug.LogWarning("Attempting to resize an object with a non manual position"); // } // } m_Active = true; this.TakeMouseCapture(); e.StopPropagation(); } }
void OnMouseDown(MouseDownEvent e) { if (m_Active) { e.StopImmediatePropagation(); return; } m_Active = false; m_Dragging = false; if (target == null) { return; } SelectionContainer = target.GetFirstAncestorOfType <ISelection>(); if (SelectionContainer == null) { // Keep for potential later use in OnMouseUp (where e.target might be different then) SelectionContainer = target.GetFirstOfType <ISelection>(); SelectedElement = e.target as GraphElement; return; } SelectedElement = target.GetFirstOfType <GraphElement>(); if (SelectedElement == null) { return; } if (e.button == (int)ActivateButton) { // avoid starting a manipulation on a non movable object if (!SelectedElement.IsDroppable()) { return; } // Reset drag and drop Vector2 localParentPosition = SelectedElement.ChangeCoordinatesTo(SelectedElement.parent, e.localMousePosition); m_DragAndDropDelay.Init(localParentPosition); m_Active = true; target.CaptureMouse(); e.StopPropagation(); } }
protected void OnMouseDown(MouseDownEvent evt) { if (!CanStartManipulation(evt)) { return; } // マウス押下では他のイベントが起きてほしくないのでPropagationを中断する if (m_Active) { evt.StopImmediatePropagation(); } }