@@ -438,12 +438,12 @@ private async Task CreateModuloExpression(ScrollViewer scrollViewer = null)
438
438
/// <param name="scrollOrientation">The ScrollOrientation</param>
439
439
private void CreateModuloExpression ( ScrollViewer scrollViewer , double imageWidth , double imageHeight , ScrollOrientation scrollOrientation )
440
440
{
441
- const string pParam = "p" ;
442
- const string offsetXParam = pParam + ". offsetX";
443
- const string offsetYParam = pParam + ". offsetY";
444
- const string imageWidthParam = pParam + ". imageWidth";
445
- const string imageHeightParam = pParam + ". imageHeight";
446
- const string speedParam = pParam + ". speed";
441
+ const string propSetParam = "p" ;
442
+ const string offsetXParam = " offsetX";
443
+ const string offsetYParam = " offsetY";
444
+ const string imageWidthParam = " imageWidth";
445
+ const string imageHeightParam = " imageHeight";
446
+ const string speedParam = " speed";
447
447
448
448
if ( _containerVisual == null )
449
449
{
@@ -457,14 +457,14 @@ private void CreateModuloExpression(ScrollViewer scrollViewer, double imageWidth
457
457
var expressionY = compositor . CreateExpressionAnimation ( ) ;
458
458
459
459
var propertySetModulo = compositor . CreatePropertySet ( ) ;
460
- propertySetModulo . InsertScalar ( "imageHeight" , ( float ) imageWidth ) ;
461
- propertySetModulo . InsertScalar ( "offsetX" , ( float ) OffsetX ) ;
462
- propertySetModulo . InsertScalar ( "imageWidth" , ( float ) imageHeight ) ;
463
- propertySetModulo . InsertScalar ( "offsetY" , ( float ) OffsetY ) ;
464
- propertySetModulo . InsertScalar ( "speed" , ( float ) ParallaxSpeedRatio ) ;
460
+ propertySetModulo . InsertScalar ( imageHeightParam , ( float ) imageWidth ) ;
461
+ propertySetModulo . InsertScalar ( offsetXParam , ( float ) OffsetX ) ;
462
+ propertySetModulo . InsertScalar ( imageWidthParam , ( float ) imageHeight ) ;
463
+ propertySetModulo . InsertScalar ( offsetYParam , ( float ) OffsetY ) ;
464
+ propertySetModulo . InsertScalar ( speedParam , ( float ) ParallaxSpeedRatio ) ;
465
465
466
- expressionX . SetReferenceParameter ( pParam , propertySetModulo ) ;
467
- expressionY . SetReferenceParameter ( pParam , propertySetModulo ) ;
466
+ expressionX . SetReferenceParameter ( propSetParam , propertySetModulo ) ;
467
+ expressionY . SetReferenceParameter ( propSetParam , propertySetModulo ) ;
468
468
469
469
string Thing ( string common , string diemtion )
470
470
=> string . Format (
@@ -481,23 +481,24 @@ string Thing(string common, string diemtion)
481
481
if ( scrollViewer == null )
482
482
{
483
483
// expressions are created to simulate a positive and negative modulo with the size of the image and the offset
484
- expressionXVal = Thing ( "Ceil(" + offsetXParam + ")" , imageHeightParam ) ;
484
+ expressionXVal = Thing ( "Ceil(" + propSetParam + "." + offsetXParam + ")" , propSetParam + "." + imageHeightParam ) ;
485
485
486
- expressionYVal = Thing ( "Ceil(" + offsetYParam + ")" , imageWidthParam ) ;
486
+ expressionYVal = Thing ( "Ceil(" + propSetParam + "." + offsetYParam + ")" , propSetParam + "." + imageWidthParam ) ;
487
487
}
488
488
else
489
489
{
490
490
// expressions are created to simulate a positive and negative modulo with the size of the image and the offset and the ScrollViewer offset (Translation)
491
491
var scrollProperties = ElementCompositionPreview . GetScrollViewerManipulationPropertySet ( scrollViewer ) ;
492
- expressionX . SetReferenceParameter ( "s" , scrollProperties ) ;
493
- expressionY . SetReferenceParameter ( "s" , scrollProperties ) ;
492
+ const string scrollParam = "s" ;
493
+ expressionX . SetReferenceParameter ( scrollParam , scrollProperties ) ;
494
+ expressionY . SetReferenceParameter ( scrollParam , scrollProperties ) ;
494
495
495
496
string LocalThing ( string scroll , string speed , string offset , string dimention )
496
497
=> Thing ( string . Format ( "Ceil(({0} * {1}) + {2})" , scroll , speed , offset ) , dimention ) ;
497
498
498
- expressionXVal = LocalThing ( "s .Translation.X", speedParam , offsetXParam , imageWidthParam ) ;
499
+ expressionXVal = LocalThing ( scrollParam + " .Translation.X", propSetParam + "." + speedParam , propSetParam + "." + offsetXParam , propSetParam + "." + imageWidthParam ) ;
499
500
500
- expressionYVal = LocalThing ( "s .Translation.Y", speedParam , offsetYParam , imageHeightParam ) ;
501
+ expressionYVal = LocalThing ( scrollParam + " .Translation.Y", propSetParam + "." + speedParam , propSetParam + "." + offsetYParam , propSetParam + "." + imageHeightParam ) ;
501
502
}
502
503
503
504
if ( scrollOrientation == ScrollOrientation . Horizontal || scrollOrientation == ScrollOrientation . Both )
0 commit comments