Hi Renaud, Renaud AUBIN wrote:
Hi all,
I would use fieldstack with \getbuffer and overlays... Why the following code doesn't work ? Is there another way to do that ?
\setlayer is breaking the fields here, so that they become normal, inactive content (dunno why). If you remove it, the fields appear... but the positioning is now the problem. For testing I defined the symbols only to be equal to one buffer at a time (not a combination of them). Without this restriction you get really funny positions for them. HTH, Peter
TIA
Renaud
%%%%%%% stack.tex
\setupcolors[state=start] \usemodule[pre-original]
\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}] \defineframedtext[FunnyText][frame=off,background=FunnyFrame] \def\StartFrame{\startFunnyText} \def\StopFrame {\stopFunnyText } \def\FrameTitle#1% {\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut#1\hss}}} \setMPtext{FunnyFrame}{} % initialize the text variable \startuseMPgraphic{FunnyFrame} picture p ; numeric o ; path a, b ; pair c ; p := textext.rt(\MPstring{FunnyFrame}) ; a := unitsquare xyscaled(OverlayWidth,OverlayHeight) ; o := BodyFontSize ; p := p shifted (2o,OverlayHeight-ypart center p) ; drawoptions (withpen pencircle scaled 1pt withcolor .625red) ; b := a randomized (o/2) ; fill b withcolor .85white ; draw b ; c := center p ; c := b intersectionpoint (c shifted (0,-o)--c shifted(0,o)) ; p := p shifted (c-center p) ; b := (boundingbox p) randomized (o/8) ; fill b withcolor .85white ; draw b ; draw p withcolor black; setbounds currentpicture to a ; \stopuseMPgraphic
\definelayer[bglayer][position=yes] \setupbackgrounds[text][background=bglayer] \setuplayer[bglayer][position=no,corner=bottom,height=\paperheight]
\starttext
\startbuffer[first] \setlayer[bglayer][x=.55\textwidth,y=.9\textheight,location=b]{ \FrameTitle{Knuth} \StartFrame[width=.75\textwidth] \input knuth \StopFrame } \stopbuffer
\startbuffer[second] \setlayer[bglayer][x=.625\textwidth,y=.8\textheight,location=b]{ \FrameTitle{Zapf} \StartFrame[width=.75\textwidth] \input zapf \StopFrame } \stopbuffer
\startbuffer[third] \setlayer[bglayer][x=.70\textwidth,y=.7\textheight,location=b]{ \FrameTitle{Tufte} \StartFrame[width=.75\textwidth] \input tufte \StopFrame } \stopbuffer
\definesymbol[empty][] \definesymbol[one][{\getbuffer[first]}] \definesymbol[two][{\getbuffer[first,second]}] \definesymbol[three][{\getbuffer[first,second,third]}]
\Topic{Stacks \& Layers}
{\setupbodyfont[12pt]
\definefieldstack[sequence] [one,two,three] [frame=off, offset=none, clickin=JS(Walk_Field{sequence})]
{\fieldstack[sequence]}
\goto{next}[JS(Walk_Field{sequence})] }
\stoptext
------------------------------------------------------------------------
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context