/// <summary> /// Handles the MouseUp 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_MouseUp(object sender, MouseEventArgs e) { // If we don't have focus, don't ruin our sprite trying to get it back. if (!panelSprite.Focused) { panelSprite.Focus(); return; } try { switch (SpriteEditorMode) { case SpriteEditorMode.AnchorDrag: SpriteEditorMode = SpriteEditorMode.View; _dragDelta = Point.Empty; panelSprite.Cursor = Cursors.Default; _content.RefreshProperty("Anchor"); break; case SpriteEditorMode.Edit: if (!_clipper.OnMouseUp(e)) { return; } var newRegion = Rectangle.Round(_clipper.ClipRegion); _content.Size = newRegion.Size; _content.TextureRegion = newRegion; _clipper.TextureSize = _content.Texture.Settings.Size; _clipper.Scale = new Vector2(1); break; } } catch (Exception ex) { GorgonDialogs.ErrorBox(ParentForm, ex); } finally { Cursor.Current = Cursors.Default; } }
/// <summary> /// Handles the MouseUp 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_MouseUp(object sender, MouseEventArgs e) { if (_clipper == null) { return; } try { if (_clipper.OnMouseUp(e)) { EnableNumericLimits(); } } catch (Exception ex) { GorgonDialogs.ErrorBox(ParentForm, ex); } finally { UpdateLabelInfo(); ValidateCommands(); } }