Layers: corner, location
Hello, I'm trying to understand meaning of "location" and "corner" keywords of layer definition (http://wiki.contextgarden.net/Layers#My_first_Layer). The goal is to place a logo (here: a \framed) to the top right corner of the page, with vertical and horizontal shift 5 mm into the centre of the page. The working code is: ---- \definelayer [Logo] [location={left,bottom}, x=\paperwidth, y=0mm, hoffset=-5mm, voffset=5mm, ] \setlayer [Logo] {\framed[width=4cm,height=1cm]{LOGO}} \setupbackgrounds[page][background=Logo] \starttext \input knuth \stoptext ---- Although it works, it's a result of many attempts. I don't understand why "location={left,bottom}" is the correct choice although the referential point of the logo is *right-top* corner and I'm placing the logo into the *right-top* corner of the layer (page). I played with "corner=" and "location=" combinations but - it seems the only one which gives the good result is the one above. Could anyone explain this? Thanks in advance. Best regards, Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
On 6/7/2013 9:07 AM, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
Hello,
I'm trying to understand meaning of "location" and "corner" keywords of layer definition (http://wiki.contextgarden.net/Layers#My_first_Layer).
The goal is to place a logo (here: a \framed) to the top right corner of the page, with vertical and horizontal shift 5 mm into the centre of the page.
The working code is:
---- \definelayer [Logo] [location={left,bottom}, x=\paperwidth, y=0mm, hoffset=-5mm, voffset=5mm, ]
\setlayer [Logo] {\framed[width=4cm,height=1cm]{LOGO}}
\setupbackgrounds[page][background=Logo]
\starttext \input knuth \stoptext ----
Although it works, it's a result of many attempts. I don't understand why "location={left,bottom}" is the correct choice although the referential point of the logo is *right-top* corner and I'm placing the logo into the *right-top* corner of the layer (page).
I played with "corner=" and "location=" combinations but - it seems the only one which gives the good result is the one above.
Could anyone explain this?
see end of pack-box.mkiv for relationship between corner and location; it has to do with matching reference points of content and position on layer ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hello,
On Fri, 07 Jun 2013 09:27:14 +0200, Hans Hagen
On 6/7/2013 9:07 AM, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
The working code is:
---- \definelayer [Logo] [location={left,bottom}, x=\paperwidth, y=0mm, hoffset=-5mm, voffset=5mm, ]
\setlayer [Logo] {\framed[width=4cm,height=1cm]{LOGO}}
\setupbackgrounds[page][background=Logo]
\starttext \input knuth \stoptext ----
see end of pack-box.mkiv for relationship between corner and location; it has to do with matching reference points of content and position on layer
Thanks for the trial to hint me - I'm no smarter from that .mkiv source. You just inspired me so the code bellow works, too, and "corner=" and "location=" are more meaningful in this version: ---- \definelayer [Logo] [width=\paperwidth, corner={right,top}, location={left,bottom}, hoffset=5mm, voffset=5mm, state=repeat, ] ---- Best regards, Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
Am 07.06.2013 10:06, schrieb Procházka Lukáš Ing. - Pontex s. r. o.:
Hello,
On Fri, 07 Jun 2013 09:27:14 +0200, Hans Hagen
wrote: On 6/7/2013 9:07 AM, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
The working code is:
---- \definelayer [Logo] [location={left,bottom}, x=\paperwidth, y=0mm, hoffset=-5mm, voffset=5mm, ]
\setlayer [Logo] {\framed[width=4cm,height=1cm]{LOGO}}
\setupbackgrounds[page][background=Logo]
\starttext \input knuth \stoptext ----
see end of pack-box.mkiv for relationship between corner and location; it has to do with matching reference points of content and position on layer
Thanks for the trial to hint me - I'm no smarter from that .mkiv source.
The layer is divided into a 2x2 matrix of squares, where 'x' is the center. This gets you a total of 3x3=9 different corners. o---o---o | | | o---x---o | | | o---o---o Now you choose one 'corner' (the reference point) for the placement. The placement is done in relation to this point. The chosen 'corner' c is our new 'center point' (only for placement) now. With 'location' you define, where (in relation to 'corner') the content is placed. Again you have nine different corners to choose from. An example to make this clear. 'corner={top,right}, location={bottom,right}' will place content in the area L (outside the original layer). Think about the 'corner' c as a magnetic grid point, where the content snaps to. The 'location' l defines, from which direction we approach the point c. x = layer center point c = corner 'top,right', d = location 'bottom right', L = location (area) o---o---o | | | ----o---c---o | | | L | ----x---o---d | | | --------- I hope I haven't mixed things up. Feel free to correct this and to wikify the final version. Peter
You just inspired me so the code bellow works, too, and "corner=" and "location=" are more meaningful in this version:
---- \definelayer [Logo] [width=\paperwidth, corner={right,top}, location={left,bottom}, hoffset=5mm, voffset=5mm, state=repeat, ] ----
Best regards,
Lukas
Hello,
thanks Peter for the explanation.
On Fri, 07 Jun 2013 14:41:45 +0200, Peter Rolf
The layer is divided into a 2x2 matrix of squares, where 'x' is the center. This gets you a total of 3x3=9 different corners.
o---o---o | | | o---x---o | | | o---o---o
Now you choose one 'corner' (the reference point) for the placement. The placement is done in relation to this point. The chosen 'corner' c is our new 'center point' (only for placement) now.
With 'location' you define, where (in relation to 'corner') the content is placed. Again you have nine different corners to choose from.
An example to make this clear.
'corner={top,right}, location={bottom,right}' will place content in the area L (outside the original layer). Think about the 'corner' c as a magnetic grid point, where the content snaps to. The 'location' l defines, from which direction we approach the point c.
x = layer center point c = corner 'top,right', d = location 'bottom right', L = location (area)
o---o---o | | | ----o---c---o | | | L | ----x---o---d | | | ---------
I hope I haven't mixed things up. Feel free to correct this and to wikify the final version.
I added some info to wiki: http://wiki.contextgarden.net/Layers#Understanding_.22location.22_and_.22cor... Best regards, Lukas
Peter
-- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
participants (3)
-
Hans Hagen
-
Peter Rolf
-
Procházka Lukáš Ing. - Pontex s. r. o.