@@ -466,30 +466,27 @@ private void CreateModuloExpression(ScrollViewer scrollViewer, double imageWidth
466
466
expressionX . SetReferenceParameter ( pParam , propertySetModulo ) ;
467
467
expressionY . SetReferenceParameter ( pParam , propertySetModulo ) ;
468
468
469
- var imageHeightNode = imageHeightParam ;
470
- var imageWidthNode = imageWidthParam ;
471
-
472
469
string expressionXVal ;
473
470
string expressionYVal ;
474
471
if ( scrollViewer == null )
475
472
{
476
- var offsetXNode = "Ceil(" + offsetXParam + ")" ;
477
- var offsetYNode = "Ceil(" + offsetYParam + ")" ;
473
+ var xCommon = "Ceil(" + offsetXParam + ")" ;
474
+ var yCommon = "Ceil(" + offsetYParam + ")" ;
478
475
479
476
// expressions are created to simulate a positive and negative modulo with the size of the image and the offset
480
477
expressionXVal =
481
- $ "{ offsetXNode } == 0 " +
478
+ $ "{ xCommon } == 0 " +
482
479
$ "? 0 " +
483
- $ ": { offsetXNode } < 0 " +
484
- $ "? -(Abs({ offsetXNode } - (Ceil({ offsetXNode } / { imageWidthNode } ) * { imageWidthNode } )) % { imageWidthNode } ) " +
485
- $ ": -({ imageWidthNode } - ({ offsetXNode } % { imageWidthNode } ))";
480
+ $ ": { xCommon } < 0 " +
481
+ $ "? -(Abs({ xCommon } - (Ceil({ xCommon } / { imageWidthParam } ) * { imageWidthParam } )) % { imageWidthParam } ) " +
482
+ $ ": -({ imageWidthParam } - ({ xCommon } % { imageWidthParam } ))";
486
483
487
484
expressionYVal =
488
- $ "{ offsetYNode } == 0 " +
485
+ $ "{ yCommon } == 0 " +
489
486
$ "? 0 " +
490
- $ ": { offsetYNode } < 0 " +
491
- $ "? -(Abs({ offsetYNode } - (Ceil({ offsetYNode } / { imageHeightNode } ) * { imageHeightNode } )) % { imageHeightNode } ) " +
492
- $ ": -({ imageHeightNode } - ({ offsetYNode } % { imageHeightNode } ))";
487
+ $ ": { yCommon } < 0 " +
488
+ $ "? -(Abs({ yCommon } - (Ceil({ yCommon } / { imageHeightParam } ) * { imageHeightParam } )) % { imageHeightParam } ) " +
489
+ $ ": -({ imageHeightParam } - ({ yCommon } % { imageHeightParam } ))";
493
490
}
494
491
else
495
492
{
@@ -498,22 +495,21 @@ private void CreateModuloExpression(ScrollViewer scrollViewer, double imageWidth
498
495
expressionX . SetReferenceParameter ( "s" , scrollProperties ) ;
499
496
expressionY . SetReferenceParameter ( "s" , scrollProperties ) ;
500
497
501
- var speed = speedParam ;
502
- var xCommon = $ "Ceil((s.Translation.X * { speed } ) + { offsetXParam } )";
498
+ var xCommon = $ "Ceil((s.Translation.X * { speedParam } ) + { offsetXParam } )";
503
499
expressionXVal =
504
500
$ "{ xCommon } == 0 " +
505
501
"? 0 " +
506
502
$ ": { xCommon } < 0 " +
507
- $ "? -(Abs({ xCommon } - (Ceil({ xCommon } / { imageWidthNode } ) * { imageWidthNode } )) % { imageWidthNode } ) " +
508
- $ ": -({ imageWidthNode } - ({ xCommon } % { imageWidthNode } ))";
503
+ $ "? -(Abs({ xCommon } - (Ceil({ xCommon } / { imageWidthParam } ) * { imageWidthParam } )) % { imageWidthParam } ) " +
504
+ $ ": -({ imageWidthParam } - ({ xCommon } % { imageWidthParam } ))";
509
505
510
- var yCommon = $ "Ceil((s.Translation.Y * { speed } ) + { offsetYParam } )";
506
+ var yCommon = $ "Ceil((s.Translation.Y * { speedParam } ) + { offsetYParam } )";
511
507
expressionYVal =
512
508
$ "{ yCommon } == 0 " +
513
509
"? 0 " +
514
510
$ ": { yCommon } < 0 " +
515
- $ "? -(Abs({ yCommon } - (Ceil({ yCommon } / { imageHeightNode } ) * { imageHeightNode } )) % { imageHeightNode } ) " +
516
- $ ": -({ imageHeightNode } - ({ yCommon } % { imageHeightNode } ))";
511
+ $ "? -(Abs({ yCommon } - (Ceil({ yCommon } / { imageHeightParam } ) * { imageHeightParam } )) % { imageHeightParam } ) " +
512
+ $ ": -({ imageHeightParam } - ({ yCommon } % { imageHeightParam } ))";
517
513
}
518
514
519
515
if ( scrollOrientation == ScrollOrientation . Horizontal || scrollOrientation == ScrollOrientation . Both )
0 commit comments