@@ -1926,9 +1926,9 @@ private void inkCanvas_PreviewTouchDown(object sender, TouchEventArgs e)
19261926 lastTouchDownStrokeCollection = inkCanvas . Strokes . Clone ( ) ;
19271927 }
19281928 //设备两个及两个以上,将画笔功能关闭
1929- if ( dec . Count > 1 || isSingleFingerDragMode || ! Settings . Gesture . IsEnableTwoFingerZoom )
1929+ if ( dec . Count > 1 || isSingleFingerDragMode || ! Settings . Gesture . IsEnableTwoFingerGesture )
19301930 {
1931- if ( isInMultiTouchMode || ! Settings . Gesture . IsEnableTwoFingerZoom ) return ;
1931+ if ( isInMultiTouchMode || ! Settings . Gesture . IsEnableTwoFingerGesture ) return ;
19321932 if ( inkCanvas . EditingMode != InkCanvasEditingMode . None && inkCanvas . EditingMode != InkCanvasEditingMode . Select )
19331933 {
19341934 lastInkCanvasEditingMode = inkCanvas . EditingMode ;
@@ -1984,7 +1984,7 @@ private void Main_Grid_ManipulationCompleted(object sender, ManipulationComplete
19841984
19851985 private void Main_Grid_ManipulationDelta ( object sender , ManipulationDeltaEventArgs e )
19861986 {
1987- if ( isInMultiTouchMode || ! Settings . Gesture . IsEnableTwoFingerZoom ) return ;
1987+ if ( isInMultiTouchMode || ! Settings . Gesture . IsEnableTwoFingerGesture ) return ;
19881988 if ( ( dec . Count >= 2 && ( Settings . PowerPointSettings . IsEnableTwoFingerGestureInPresentationMode || StackPanelPPTControls . Visibility != Visibility . Visible || StackPanelPPTButtons . Visibility == Visibility . Collapsed ) ) || isSingleFingerDragMode )
19891989 {
19901990 ManipulationDelta md = e . DeltaManipulation ;
@@ -2000,12 +2000,12 @@ private void Main_Grid_ManipulationDelta(object sender, ManipulationDeltaEventAr
20002000 center = m . Transform ( center ) ; // 转换为矩阵缩放和旋转的中心点
20012001
20022002 // Update matrix to reflect translation/rotation
2003- m . Translate ( trans . X , trans . Y ) ; // 移动
2003+ if ( Settings . Gesture . IsEnableTwoFingerTranslate )
2004+ m . Translate ( trans . X , trans . Y ) ; // 移动
20042005 if ( Settings . Gesture . IsEnableTwoFingerRotation )
2005- {
20062006 m . RotateAt ( rotate , center . X , center . Y ) ; // 旋转
2007- }
2008- m . ScaleAt ( scale . X , scale . Y , center . X , center . Y ) ; // 缩放
2007+ if ( Settings . Gesture . IsEnableTwoFingerZoom )
2008+ m . ScaleAt ( scale . X , scale . Y , center . X , center . Y ) ; // 缩放
20092009
20102010 StrokeCollection strokes = inkCanvas . GetSelectedStrokes ( ) ;
20112011 if ( strokes . Count != 0 )
@@ -2025,12 +2025,15 @@ private void Main_Grid_ManipulationDelta(object sender, ManipulationDeltaEventAr
20252025 }
20262026 }
20272027
2028- try
2028+ if ( Settings . Gesture . IsEnableTwoFingerZoom )
20292029 {
2030- stroke . DrawingAttributes . Width *= md . Scale . X ;
2031- stroke . DrawingAttributes . Height *= md . Scale . Y ;
2030+ try
2031+ {
2032+ stroke . DrawingAttributes . Width *= md . Scale . X ;
2033+ stroke . DrawingAttributes . Height *= md . Scale . Y ;
2034+ }
2035+ catch { }
20322036 }
2033- catch { }
20342037 }
20352038 }
20362039 else
@@ -2039,12 +2042,15 @@ private void Main_Grid_ManipulationDelta(object sender, ManipulationDeltaEventAr
20392042 {
20402043 stroke . Transform ( m , false ) ;
20412044
2042- try
2045+ if ( Settings . Gesture . IsEnableTwoFingerZoom )
20432046 {
2044- stroke . DrawingAttributes . Width *= md . Scale . X ;
2045- stroke . DrawingAttributes . Height *= md . Scale . Y ;
2047+ try
2048+ {
2049+ stroke . DrawingAttributes . Width *= md . Scale . X ;
2050+ stroke . DrawingAttributes . Height *= md . Scale . Y ;
2051+ }
2052+ catch { }
20462053 }
2047- catch { }
20482054 }
20492055 foreach ( Circle circle in circles )
20502056 {
@@ -2282,6 +2288,8 @@ private void PptApplication_SlideShowBegin(SlideShowWindow Wn)
22822288 LogHelper . WriteLogToFile ( "PowerPoint Application Slide Show Begin" , LogHelper . LogType . Event ) ;
22832289 Application . Current . Dispatcher . Invoke ( ( ) =>
22842290 {
2291+ // 退出画板模式
2292+ BtnSwitch_Click ( null , null ) ;
22852293 //调整颜色
22862294 double screenRatio = SystemParameters . PrimaryScreenWidth / SystemParameters . PrimaryScreenHeight ;
22872295 if ( Math . Abs ( screenRatio - 16.0 / 9 ) <= - 0.01 )
@@ -2902,7 +2910,7 @@ private void ToggleSwitchShowCursor_Toggled(object sender, RoutedEventArgs e)
29022910 #endregion
29032911
29042912 #region Canvas
2905-
2913+
29062914 private void ComboBoxPenStyle_SelectionChanged ( object sender , SelectionChangedEventArgs e )
29072915 {
29082916 if ( ! isLoaded ) return ;
@@ -3107,6 +3115,15 @@ private void ToggleSwitchEnableTwoFingerZoom_Toggled(object sender, RoutedEventA
31073115 SaveSettingsToFile ( ) ;
31083116 }
31093117
3118+ private void ToggleSwitchEnableTwoFingerTranslate_Toggled ( object sender , RoutedEventArgs e )
3119+ {
3120+ if ( ! isLoaded ) return ;
3121+
3122+ Settings . Gesture . IsEnableTwoFingerTranslate = ToggleSwitchEnableTwoFingerTranslate . IsOn ;
3123+
3124+ SaveSettingsToFile ( ) ;
3125+ }
3126+
31103127 private void ToggleSwitchEnableTwoFingerRotation_Toggled ( object sender , RoutedEventArgs e )
31113128 {
31123129 if ( ! isLoaded ) return ;
@@ -4796,16 +4813,31 @@ private void MouseTouchMove(Point endP)
47964813 {
47974814 //第二笔:画双曲线
47984815 double k = drawMultiStepShapeSpecialParameter3 ;
4799- a = Math . Sqrt ( Math . Abs ( ( endP . X - iniP . X ) * ( endP . X - iniP . X ) - ( endP . Y - iniP . Y ) * ( endP . Y - iniP . Y ) / ( k * k ) ) ) ;
4800- b = a * k ;
4801- pointList = new List < Point > ( ) ;
4802- for ( double i = a ; i <= Math . Abs ( endP . X - iniP . X ) ; i += 0.5 )
4803- {
4804- double rY = Math . Sqrt ( Math . Abs ( k * k * i * i - b * b ) ) ;
4805- pointList . Add ( new Point ( iniP . X + i , iniP . Y - rY ) ) ;
4806- pointList2 . Add ( new Point ( iniP . X + i , iniP . Y + rY ) ) ;
4807- pointList3 . Add ( new Point ( iniP . X - i , iniP . Y - rY ) ) ;
4808- pointList4 . Add ( new Point ( iniP . X - i , iniP . Y + rY ) ) ;
4816+ bool isHyperbolaFocalPointOnXAxis = Math . Abs ( ( endP . Y - iniP . Y ) / ( endP . X - iniP . X ) ) < k ;
4817+ if ( isHyperbolaFocalPointOnXAxis ) { // 焦点在 x 轴上
4818+ a = Math . Sqrt ( Math . Abs ( ( endP . X - iniP . X ) * ( endP . X - iniP . X ) - ( endP . Y - iniP . Y ) * ( endP . Y - iniP . Y ) / ( k * k ) ) ) ;
4819+ b = a * k ;
4820+ pointList = new List < Point > ( ) ;
4821+ for ( double i = a ; i <= Math . Abs ( endP . X - iniP . X ) ; i += 0.5 )
4822+ {
4823+ double rY = Math . Sqrt ( Math . Abs ( k * k * i * i - b * b ) ) ;
4824+ pointList . Add ( new Point ( iniP . X + i , iniP . Y - rY ) ) ;
4825+ pointList2 . Add ( new Point ( iniP . X + i , iniP . Y + rY ) ) ;
4826+ pointList3 . Add ( new Point ( iniP . X - i , iniP . Y - rY ) ) ;
4827+ pointList4 . Add ( new Point ( iniP . X - i , iniP . Y + rY ) ) ;
4828+ }
4829+ } else { // 焦点在 y 轴上
4830+ a = Math . Sqrt ( Math . Abs ( ( endP . Y - iniP . Y ) * ( endP . Y - iniP . Y ) - ( endP . X - iniP . X ) * ( endP . X - iniP . X ) * ( k * k ) ) ) ;
4831+ b = a / k ;
4832+ pointList = new List < Point > ( ) ;
4833+ for ( double i = a ; i <= Math . Abs ( endP . Y - iniP . Y ) ; i += 0.5 )
4834+ {
4835+ double rX = Math . Sqrt ( Math . Abs ( i * i / k / k - b * b ) ) ;
4836+ pointList . Add ( new Point ( iniP . X - rX , iniP . Y + i ) ) ;
4837+ pointList2 . Add ( new Point ( iniP . X + rX , iniP . Y + i ) ) ;
4838+ pointList3 . Add ( new Point ( iniP . X - rX , iniP . Y - i ) ) ;
4839+ pointList4 . Add ( new Point ( iniP . X + rX , iniP . Y - i ) ) ;
4840+ }
48094841 }
48104842 try
48114843 {
@@ -4825,12 +4857,12 @@ private void MouseTouchMove(Point endP)
48254857 {
48264858 //画焦点
48274859 c = Math . Sqrt ( a * a + b * b ) ;
4828- stylusPoint = new StylusPoint ( iniP . X + c , iniP . Y , ( float ) 1.0 ) ;
4860+ stylusPoint = isHyperbolaFocalPointOnXAxis ? new StylusPoint ( iniP . X + c , iniP . Y , ( float ) 1.0 ) : new StylusPoint ( iniP . X , iniP . Y + c , ( float ) 1.0 ) ;
48294861 point = new StylusPointCollection ( ) ;
48304862 point . Add ( stylusPoint ) ;
48314863 stroke = new Stroke ( point ) { DrawingAttributes = inkCanvas . DefaultDrawingAttributes . Clone ( ) } ;
48324864 strokes . Add ( stroke . Clone ( ) ) ;
4833- stylusPoint = new StylusPoint ( iniP . X - c , iniP . Y , ( float ) 1.0 ) ;
4865+ stylusPoint = isHyperbolaFocalPointOnXAxis ? new StylusPoint ( iniP . X - c , iniP . Y , ( float ) 1.0 ) : new StylusPoint ( iniP . X , iniP . Y - c , ( float ) 1.0 ) ;
48344866 point = new StylusPointCollection ( ) ;
48354867 point . Add ( stylusPoint ) ;
48364868 stroke = new Stroke ( point ) { DrawingAttributes = inkCanvas . DefaultDrawingAttributes . Clone ( ) } ;
0 commit comments