MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Zoom2D

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82866] Zoom2D
  • From: dh <dh at metrohm.ch>
  • Date: Thu, 1 Nov 2007 05:24:29 -0500 (EST)

Hello,

since I posted the Zoom2D utility I got a few complains that it is not 

working properly with complicated graphics.

The main problem seems that on clicking on a graphics you get a data 

structure "GraphicsBox" that I could not find any documentation. This 

structure is not behaving well for complicated graphics. Mainly the 

location of the upper/right and lower/left corner of the graphics is 

reported wrongly. Therefore, it is possible that the locators are 

msiplaced by Zoom2D.

I also eliminated another possible source of troubles: the undocumented 

statement: "BoxForm`ClosingSaveDialog" that gives error messages on some 

machines, but not on all. I am not able to tell why.

Therefore here is a new version that should give less troubles:



==========================================================

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}],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->""];



===========================================================




  • Prev by Date: Exporting Graphics into PowerPoint - Font Problems
  • Next by Date: Re: Bug of Integrate
  • Previous by thread: Re: Exporting Graphics into PowerPoint - Font Problems
  • Next by thread: Re: Frequency response function