Hi there,

 

I am overlaying images on a multiscaleimage (deepzoom composition).  I
am doing this by using the position of MultiscaleSubImage as a
placeholder for the overlay.

 

It is almost perfect, except that as the user pans and zooms the image
'floats' around.  It seems symptomatic of a rounding problem but I can't
put my finger on it.

 

I worked out another way to calculate the x-axis position, where it
works perfectly and doesn't float but I was having trouble calculating
the y-axis position using the same method due to the aspect ratio I
think.  In that version the y-axis position didn't float but it was
always approximately 30% too high up the screen.

 

Any suggestions?

Here is my code for the version that puts the overlay in the correct
position, but it floats when panning / zooming :

 

 

 

internal void DrawSubImageOverlay(MultiScaleSubImage subImage, Grid
imageContainer)

        {                               

            double scaleBy = 1 / subImage.ViewportWidth * 1 /
msi.ViewportWidth;

 

            double width = scaleBy * this.msi.ActualWidth;

            double height = (scaleBy * this.msi.ActualWidth * (1 /
subImage.AspectRatio));

 

            imageContainer.Width = width;

            imageContainer.Height = height;

 

            Point testPoint = msi.LogicalToElementPoint(

              new Point(

                   -subImage.ViewportOrigin.X * (1 /
subImage.ViewportWidth),

                  -subImage.ViewportOrigin.Y * (1 /
subImage.ViewportWidth)));

 

            Canvas.SetLeft(imageContainer, testPoint.X);

            Canvas.SetTop(imageContainer, testPoint.Y);            

        }

_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to