8000 Try fix the first point in StylusPlugin in high DPI · dotnet-campus/wpf@7282478 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7282478

Browse files
committed
Try fix the first point in StylusPlugin in high DPI
dotnet#6415
1 parent 8894edf commit 7282478

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenContexts.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ internal void InvokeStylusPluginCollection(RawStylusInputReport inputReport)
440440
{
441441
// Create new RawStylusInput to send
442442
GeneralTransformGroup transformTabletToView = new GeneralTransformGroup();
443-
transformTabletToView.Children.Add(new MatrixTransform(_stylusLogic.GetTabletToViewTransform(stylusDevice.CriticalActiveSource, stylusDevice.TabletDevice))); // this gives matrix in measured units (not device)
443+
transformTabletToView.Children.Add(new MatrixTransform(_stylusLogic.GetTabletToViewTransform(stylusDevice.CriticalActiveSource ?? inputReport.InputSource, stylusDevice.TabletDevice))); // this gives matrix in measured units (not device)
444444
transformTabletToView.Children.Add(currentPic.ViewToElement); // Make it relative to the element.
445445
transformTabletToView.Freeze(); // Must be frozen for multi-threaded access.
446446

@@ -459,7 +459,7 @@ internal void InvokeStylusPluginCollection(RawStylusInputReport inputReport)
459459
// The transformTabletToView matrix and plugincollection rects though can change based
460460
// off of layout events which is why we need to lock this.
461461
GeneralTransformGroup transformTabletToView = new GeneralTransformGroup();
462-
transformTabletToView.Children.Add(new MatrixTransform(_stylusLogic.GetTabletToViewTransform(stylusDevice.CriticalActiveSource, stylusDevice.TabletDevice))); // this gives matrix in measured units (not device)
462+
transformTabletToView.Children.Add(new MatrixTransform(_stylusLogic.GetTabletToViewTransform(stylusDevice.CriticalActiveSource ?? inputReport.InputSource, stylusDevice.TabletDevice))); // this gives matrix in measured units (not device)
463463
transformTabletToView.Children.Add(pic.ViewToElement); // Make it relative to the element.
464464
transformTabletToView.Freeze(); // Must be frozen for multi-threaded access.
465465

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/WispLogic.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,7 +2670,8 @@ private void VerifyStylusPlugInCollectionTarget(RawStylusInputReport rawStylusIn
26702670
// The transformTabletToView matrix and plugincollection rects though can change based
26712671
// off of layout events which is why we need to lock this.
26722672
GeneralTransformGroup transformTabletToView = new GeneralTransformGroup();
2673-
transformTabletToView.Children.Add(new MatrixTransform(GetTabletToViewTransform(stylusDevice.CriticalActiveSource, stylusDevice.TabletDevice))); // this gives matrix in measured units (not device)
2673+
transformTabletToView.Children.Add(new MatrixTransform(GetTabletToViewTransform(
2674+
stylusDevice.CriticalActiveSource ?? rawStylusInputReport.InputSource, stylusDevice.TabletDevice))); // this gives matrix in measured units (not device)
26742675
transformTabletToView.Children.Add(targetPIC.ViewToElement); // Make it relative to the element.
26752676
transformTabletToView.Freeze(); // Must be frozen for multi-threaded access.
26762677

@@ -2689,7 +2690,7 @@ private void VerifyStylusPlugInCollectionTarget(RawStylusInputReport rawStylusIn
26892690
if (originalRSI == null)
26902691
{
26912692
GeneralTransformGroup transformTabletToView = new GeneralTransformGroup();
2692-
transformTabletToView.Children.Add(new MatrixTransform(GetTabletToViewTransform(stylusDevice.CriticalActiveSource, stylusDevice.TabletDevice))); // this gives matrix in measured units (not device)
2693+
transformTabletToView.Children.Add(new MatrixTransform(GetTabletToViewTransform(stylusDevice.CriticalActiveSource ?? rawStylusInputReport.InputSource, stylusDevice.TabletDevice))); // this gives matrix in measured units (not device)
26932694
transformTabletToView.Children.Add(currentTarget.ViewToElement); // Make it relative to the element.
26942695
transformTabletToView.Freeze(); // Must be frozen for multi-threaded access.
26952696
originalRSI = new RawStylusInput(rawStylusInputReport, transformTabletToView, currentTarget);

0 commit comments

Comments
 (0)
0