Glimmr Automap

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section: Anchor elements

    Glimmr Automap handles window-canvas display differently from Canvas-Based Drawing. Rather than scale the canvas so that it fits the window, GLAM resizes the canvas. Each time the window is redrawn, GLAM calculates the number of tiles that will fit in the window--up to the maximum set by the "automap reserved area" use option (see above)--and changes the size of the canvas to match. The canvas is then centered in the window as per standard Canvas-Based Drawing behavior.

    This means that there is no reliable way to set the positions of other elements (such as the zoom buttons). Canvas positions aren't reliable, since the canvas dimensions can change radically at different window sizes and zoom levels. So, Glimmr Automap introduces the "anchor-element." Anchor-elements g-elements that are placed (anchored) relative to the edges of the window, rather than to the canvas grid; these elements completely ignore the canvas, and instead are placed using textual "positionings" and numerical "margins".

    GLAM includes two anchor-elements: the "UI-frame", which is a box that holds the zoom and query buttons, and the query explanation text ("UI-query-explanation," actually an external image file). If we want to add other graphic elements to the map window, it will generally be easiest to make them anchor-elements.

    Anchor-elements are placed using adjectives for gross positioning, and a number for fine-tuning. By default, both the UI-frame and the UI-query-explanation have the same gross positioning: they appear in the bottom center of the window (see the section on the query functionality for more on the UI-query-explanation g-element). There are nine possible positions, three each for the "horizontal-positioning" and "vertical-positioning" properties. We can move an anchor element around the window by changing these positionings. The positionings are:

        horizontally: left-positioned / center-positioned / right-positioned
        vertically: top-positioned / central-positioned / bottom-positioned

    So, if we wanted to move the UI-frame to the upper left of the map window, we'd type something like this:

        The UI-frame is top-positioned and left-positioned.

    We can further tweak this positioning by setting the margins. The margin is the horizontal or vertical distance (in pixels) between the nearest edge of the window and the UI frame. So, if we want to move the UI frame farther from the top of the screen, we might add to our declaration of the UI-frame's position:

        The UI-frame is top-positioned and left-positioned.
        The vertical margin of the UI-frame is 50.

    This will place the UI-frame so that 50 pixels separate it from the top of the map window, rather than the default 5.

    Note that there will be no effect if we try to set the horizontal margin of a center-positioned anchor element, or the vertical margin of a central-positioned one: the element must be anchored to an edge of the window for the margin value to be meaningful.