Zoom2D
- To: mathgroup at smc.vnet.net
- Subject: [mg81546] Zoom2D
- From: dh <dh at metrohm.ch>
- Date: Wed, 26 Sep 2007 21:47:11 -0400 (EDT)
Hello, here is an updated version of my Zoom utility for Mathematica V6.0.1: Load it in with Get and a Palette with one button is created. Then select a graphics and hit the button. Daniel ========================================================= Zoom2D[g0_]:=Module[{g,g1,pp1,pp2},tt=g0; If[!MatchQ[Head[g0],Graphics|GraphicsBox],CreateDialog[{TextCell["Zoom: No Input available."],DefaultButton[]}];Return[]; ]; g=If[Head[g0]=!=Graphics,ReplaceAll[g0,{GraphicsBox->Graphics,LineBox->Line,FormBox[x1_,x2___]:>StringReplace[x1,"\""->""]}],g0]; g=g/.NCache[_,x_]:>x; {pp1,pp2}=(PlotRange/.AbsoluteOptions[g])//Transpose; g1=DynamicModule[{p1=pp1,p2=pp2,lp={0,0},aspect=1},Column[{LocatorPane[Dynamic[{p1,p2}],Show[{g,Graphics[{Opacity[0.1],Rectangle[Dynamic[p1],Dynamic[p2]]}]},ImageSize->Small]],EventHandler[Show[g,PlotRange:>Dynamic[Transpose[{p1,p2}]],Frame->True,ImageSize->Full,AspectRatio->Dynamic[aspect]],{"MouseClicked":>(lp=MousePosition["Graphics"])}],Dynamic[lp] ,Row[{TextCell["AspectRatio fixed: "],Checkbox[Dynamic[aspect],{Automatic,1}]}]},Center]]; CreateDocument[g1,WindowSize->{Small,All},WindowTitle->"Zoom-DH",WindowElements->{},WindowFrame->"Palette",BoxForm`ClosingSaveDialog->False];] CreatePalette[Button["Zoom",Zoom2D[NotebookRead[SelectedNotebook[]]]],WindowTitle->""]; =============================================================================================