/// <summary> /// Handles the MouseMove event of the panelSprite control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param> private void panelSprite_MouseMove(object sender, MouseEventArgs e) { var textureOffset = (Point) new Vector2((e.X - _content.TextureSprite.Position.X) / _zoom, (e.Y - _content.TextureSprite.Position.Y) / _zoom); labelMouseInfo.Text = string.Format(Resources.GORSPR_TEXT_MOUSE_INFO, textureOffset.X, textureOffset.Y, _content.TextureRegion.X, _content.TextureRegion.Y, _content.TextureRegion.Right, _content.TextureRegion.Bottom, _content.TextureRegion.Width, _content.TextureRegion.Height, _content.Anchor.X, _content.Anchor.Y); switch (SpriteEditorMode) { case SpriteEditorMode.View: var anchorRect = new Rectangle((Point)(_anchorSprite.Position - Vector2.Modulate(_anchorSprite.Anchor, _anchorSprite.Scale)), (Size)_anchorSprite.ScaledSize); panelSprite.Cursor = anchorRect.Contains(e.Location) ? Cursors.Hand : Cursors.Default; break; case SpriteEditorMode.Edit: _clipper.OnMouseMove(e); UpdateZoomWindow(e.Location); break; case SpriteEditorMode.AnchorDrag: _content.Anchor = (Point) new Vector2((e.X - _spritePosition.X - _dragDelta.X) / _zoom, (e.Y - _spritePosition.Y - _dragDelta.Y) / _zoom); break; } }
/// <summary> /// Handles the MouseMove event of the panelTextureDisplay control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param> private void panelTextureDisplay_MouseMove(object sender, MouseEventArgs e) { if (_clipper == null) { return; } if (!_clipper.OnMouseMove(e)) { return; } Rectangle numericValues = Rectangle.Intersect(Rectangle.Round(_clipper.ClipRegion), new Rectangle(0, 0, _texture.Settings.Width, _texture.Settings.Height)); numericX.Value = numericValues.X; numericY.Value = numericValues.Y; numericWidth.Value = numericValues.Width; numericHeight.Value = numericValues.Height; UpdateLabelInfo(); OnBrushChanged(); }