This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
Vestan Pance  
#1 Posted : Monday, October 1, 2007 3:45:43 AM(UTC)
Vestan Pance

Rank: Member

Groups: Guest
Joined: 9/19/2007(UTC)
Posts: 4

Hi

I want to add undo to my application but I'm running up against a small problem. You've already kindly helped with the zooming in this post

As you can see from my previous post when I load the image to the bitmapviewer I set the zoom at the same time in the code behind. However when I add an undo button using the following code it doesn't respect the zoom.

aspx snippet:
Code:
    function undo(){
        bitmapViewer1.invokeRemoteMethod("undo");
    }


vb.net snippet
Code:
    <Aurigma.GraphicsMill.WebControls.RemoteScriptingMethod()> _
    Public Sub undo()
        If Not BitmapViewer1.Bitmap.IsEmpty Then
            If BitmapViewer1.Bitmap.CanUndo Then
                BitmapViewer1.Bitmap.Undo()
            End If
        End If
    End Sub


What do I need to do to get the zoom set on load and on undo?

Edited by user Tuesday, December 25, 2007 3:36:35 PM(UTC)  | Reason: Not specified

Vestan Pance  
#2 Posted : Monday, October 1, 2007 4:15:53 PM(UTC)
Vestan Pance

Rank: Member

Groups: Guest
Joined: 9/19/2007(UTC)
Posts: 4

To clarfiy, what I am trying to acheive is that the image is always displayed "best fit" and the scroll bars never need to show regardless of how large or what shape the image is.
Sergey Peshekhonov  
#3 Posted : Monday, October 1, 2007 9:44:03 PM(UTC)
Sergey Peshekhonov

Rank: Advanced Member

Groups: Guest
Joined: 6/5/2007(UTC)
Posts: 57

Hello, Vestan

As I understand your problem, you should just replace your undo() function with this code:
Code:
    function undo(){
        bitmapViewer1.invokeRemoteMethod("undo");
        updateRectangle=true;
    }

and replace your bitmapViewer1_StatusChanged() function with this code:
Code:
    function bitmapViewer1_StatusChanged(){
	var s = bitmapViewer1.getStatus();

	if (updateRectangle && s != "Busy"){
		updateRectangle = false;
		bitmapViewer1.setZoom(bitmapViewer1.offsetWidth/bitmapViewer1.bitmap.getWidth());
		rectangleRubberband1.setRectangle(new Rectangle(0, 0, bitmapViewer1.bitmap.getWidth(), bitmapViewer1.bitmap.getHeight()))
	}
    }


Also, during zoom calculation, you should take into account Height of the BitmapViewer.
Sincerely yours,
Sergey Peshekhonov.

Aurigma Technical Support Team.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.