$event:=FORM Event:C1606

Case of 
	: ($event.code=On Clicked:K2:4)
		$picturesize:=600
		//Form.mouse.x:=Mousex
		//Form.mouse.y:=Mousey
		
		PICTURE PROPERTIES:C457(Form:C1466.selectedPicture.Thumbnail; $width; $height)
		OBJECT GET COORDINATES:C663(*; "thumbnail1"; $l; $t; $r; $b)
		OBJECT GET COORDINATES:C663(*; "Rectangle"; $lt; $tt; $rt; $bt)
		$halfthumbwidth:=($rt-$lt)/2
		$halfthumbheight:=($bt-$tt)/2
		$myMouseX:=Mousex
		$myMouseY:=Mousey
		
		Case of 
			: ((Mousex+$halfthumbwidth)>$width)
				$myMouseX:=$width-$halfthumbwidth
			: ((Mousex-$halfthumbwidth)<0)
				$myMouseX:=$halfthumbwidth
		End case 
		
		Case of 
			: ((Mousey+$halfthumbheight)>$height)
				$myMouseY:=$height-$halfthumbheight
			: ((Mousey-$halfthumbheight)<0)
				$myMouseY:=$halfthumbheight
		End case 
		
		OBJECT SET COORDINATES:C1248(*; "Rectangle"; $l+$myMouseX-$halfthumbwidth; $t+$myMouseY-$halfthumbheight; $l+$myMouseX+$halfthumbwidth; $t+$myMouseY+$halfthumbwidth)
		
		$myMouseX:=$myMouseX-$halfthumbwidth
		$myMouseY:=$myMouseY-$halfthumbheight
		
		$rate1:=$myMouseX/$width
		$rate2:=$myMouseY/$height
		
		PICTURE PROPERTIES:C457(Form:C1466.selectedPicture.Picture; $bigwidth; $bigheight)
		OBJECT SET SCROLL POSITION:C906(*; "Input"; $bigheight*$rate2; $bigwidth*$rate1; *)
		
		
End case 