-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from PixiEditor/moveVPTool
Added Move Viewport (Pan) Tool
- Loading branch information
Showing
16 changed files
with
208 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
public enum ToolType | ||
{ | ||
None, | ||
MoveViewport, | ||
Move, | ||
Pen, | ||
Select, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using PixiEditor.Models.Position; | ||
using PixiEditor.ViewModels; | ||
using System.Drawing; | ||
using System.Windows.Input; | ||
|
||
namespace PixiEditor.Models.Tools.Tools | ||
{ | ||
public class MoveViewportTool : ReadonlyTool | ||
{ | ||
public override ToolType ToolType => ToolType.MoveViewport; | ||
private Point _clickPoint; | ||
|
||
public MoveViewportTool() | ||
{ | ||
HideHighlight = true; | ||
Cursor = Cursors.SizeAll; | ||
Tooltip = "Move viewport. (H)"; | ||
} | ||
|
||
public override void OnMouseDown(MouseEventArgs e) | ||
{ | ||
if (e.LeftButton == MouseButtonState.Pressed || e.MiddleButton == MouseButtonState.Pressed) | ||
{ | ||
_clickPoint = MousePositionConverter.GetCursorPosition(); | ||
} | ||
} | ||
|
||
public override void OnMouseMove(MouseEventArgs e) | ||
{ | ||
if (e.LeftButton == MouseButtonState.Pressed || e.MiddleButton == MouseButtonState.Pressed) | ||
{ | ||
var point = MousePositionConverter.GetCursorPosition(); | ||
ViewModelMain.Current.ViewportPosition = new System.Windows.Point(point.X - _clickPoint.X, | ||
point.Y - _clickPoint.Y); | ||
} | ||
} | ||
|
||
public override void OnMouseUp(MouseEventArgs e) | ||
{ | ||
if (e.MiddleButton == MouseButtonState.Pressed) | ||
{ | ||
ViewModelMain.Current.SetActiveTool(ViewModelMain.Current.LastActionTool); | ||
} | ||
} | ||
|
||
public override void Use(Coordinates[] pixels) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.