private void MouseMoveHandler(Event e) { MouseEvent me = (MouseEvent)e; Debug.Log(1); Point delta = me.GlobalPosition.Subtract(_clickCoordinates); Debug.Log(2); var position = _startCoordinates.Add(delta); Debug.Log(3); _component.Move(position.X, position.Y); Debug.Log(4); }
/// <summary> /// Mouse move handler /// Fires when in processing mode (resizing) /// </summary> /// <param name="e"></param> private void MouseMoveHandler(Event e) { if (!IsResizing) { return; } e.CancelAndStopPropagation(); MouseEvent me = (MouseEvent)e; Point position; position = me.GlobalPosition; var delta = position.Subtract(_clickCoords); switch (_resizeMode) { case ResizeMode.Right: _newBounds = _origBounds.Expand(0, delta.X, 0, 0); break; case ResizeMode.Left: _newBounds = _origBounds.Expand(-delta.X, 0, 0, 0); break; case ResizeMode.Top: _newBounds = _origBounds.Expand(0, 0, -delta.Y, 0); break; case ResizeMode.Bottom: _newBounds = _origBounds.Expand(0, 0, 0, delta.Y); break; case ResizeMode.TopLeft: _newBounds = _origBounds.Expand(-delta.X, 0, -delta.Y, 0); break; case ResizeMode.TopRight: _newBounds = _origBounds.Expand(0, delta.X, -delta.Y, 0); break; case ResizeMode.BottomLeft: _newBounds = _origBounds.Expand(-delta.X, 0, 0, delta.Y); break; case ResizeMode.BottomRight: _newBounds = _origBounds.Expand(0, delta.X, 0, delta.Y); break; } // gracefully handle the minimum sizes set by the user _newBounds.X = Mathf.Min(_newBounds.X, _origBounds.Right - _component.MinWidth); _newBounds.Y = Mathf.Min(_newBounds.Y, _origBounds.Bottom - _component.MinHeight); _newBounds.Width = Mathf.Min(Mathf.Max(_newBounds.Width, _component.MinWidth), _component.MaxWidth); // MeasuredMinWidth _newBounds.Height = Mathf.Min(Mathf.Max(_newBounds.Height, _component.MinHeight), _component.MaxHeight); // apply if (ChangeExplicitSize) { _component.Width = _newBounds.Width; _component.Height = _newBounds.Height; } else { _component.SetActualSize(_newBounds.Width, _newBounds.Height); } _component.Move(_newBounds.X, _newBounds.Y); /** * When resizing by the top/left edge, the visual jitter can be observed in component's right-aligned children * so to avoid this jitter, we should validate now * */ if (_resizeMode == ResizeMode.Left || _resizeMode == ResizeMode.Top || _resizeMode == ResizeMode.TopLeft) { //_component.ValidateNow(); } }