mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
override cursor within image preview pane.
This commit is contained in:
parent
07eb5c07f0
commit
f7e395b76b
@ -24,6 +24,16 @@ namespace GARbro.GUI
|
||||
{
|
||||
obj.SetValue(IsEnabledProperty, value);
|
||||
}
|
||||
|
||||
public static Cursor GetDraggingCursor (UIElement e)
|
||||
{
|
||||
return (Cursor)e.GetValue (DraggingCursorProperty);
|
||||
}
|
||||
|
||||
public static void SetDraggingCursor (UIElement e, Cursor value)
|
||||
{
|
||||
e.SetValue (DraggingCursorProperty, value);
|
||||
}
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
@ -31,8 +41,16 @@ namespace GARbro.GUI
|
||||
set { SetValue(IsEnabledProperty, value); }
|
||||
}
|
||||
|
||||
public Cursor DraggingCursor
|
||||
{
|
||||
get { return (Cursor)GetValue (DraggingCursorProperty); }
|
||||
set { SetValue (DraggingCursorProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsEnabledProperty =
|
||||
DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(TouchScrolling), new UIPropertyMetadata(false, IsEnabledChanged));
|
||||
public static readonly DependencyProperty DraggingCursorProperty =
|
||||
DependencyProperty.RegisterAttached("DraggingCursor", typeof(Cursor), typeof(TouchScrolling));
|
||||
|
||||
static Dictionary<object, MouseCapture> _captures = new Dictionary<object, MouseCapture>();
|
||||
|
||||
@ -109,7 +127,7 @@ namespace GARbro.GUI
|
||||
if (target == null) return;
|
||||
|
||||
target.ReleaseMouseCapture();
|
||||
target.Cursor = Cursors.Arrow;
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
|
||||
static void target_PreviewMouseMove(object sender, MouseEventArgs e)
|
||||
@ -138,7 +156,9 @@ namespace GARbro.GUI
|
||||
if (System.Math.Abs(dy) > 5 || System.Math.Abs(dx) > 5)
|
||||
{
|
||||
target.CaptureMouse();
|
||||
target.Cursor = Cursors.SizeAll;
|
||||
var cursor = target.GetValue (DraggingCursorProperty) as Cursor;
|
||||
if (cursor != null)
|
||||
Mouse.OverrideCursor = cursor;
|
||||
}
|
||||
scroller.ScrollToHorizontalOffset(capture.HorizontalOffset - dx);
|
||||
scroller.ScrollToVerticalOffset(capture.VerticalOffset - dy);
|
||||
|
@ -271,6 +271,12 @@
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\Cursors\grab.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\Cursors\grabbing.cur" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>perl "$(SolutionDir)inc-revision.pl" "$(ProjectPath)" $(ConfigurationName) "$(SolutionDir)\"
|
||||
|
@ -343,7 +343,8 @@
|
||||
<Grid Grid.Column="2" Name="PreviewPane" SnapsToDevicePixels="True">
|
||||
<ScrollViewer Name="ImageView" Background="LightGray" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Image Name="ImageCanvas" Stretch="None" UseLayoutRounding="True" SnapsToDevicePixels="True"
|
||||
local:TouchScrolling.IsEnabled="True" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
|
||||
local:TouchScrolling.IsEnabled="True" RenderOptions.BitmapScalingMode="NearestNeighbor"
|
||||
Cursor="Images/Cursors/grab.cur" local:TouchScrolling.DraggingCursor="Images/Cursors/grabbing.cur" />
|
||||
</ScrollViewer>
|
||||
<jv:TextViewer x:Name="TextView" Visibility="Collapsed" BorderThickness="1,0,0,0" BorderBrush="Black"/>
|
||||
</Grid>
|
||||
|
Loading…
x
Reference in New Issue
Block a user