Glimmr Automap

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Element scaling for UI elements

    [The first rule bypasses the standard g-element scaling rule, which automatically scales the origin of an element to the window. Because we are calculating the origins of UI-elements based on the window itself, we have no need to scale. The second rule rule provides a handy place to do these calculations. The third rule arranges the buttons on the frame, based on the position of the frame as calculated by the second rule.]
        
    An element scaling rule for an anchor-element (called the current-element) (this is the anchor placement rule):
        if the current-element is right-positioned:
            now entry 1 of the origin of the current-element is the width of the current window - (image-width of image-ID of current-element + horizontal margin of current-element);
            [say "Calculated: [entry 1 of the origin of the current-element].";]
        if the current-element is left-positioned:
            now entry 1 of the origin of the current-element is horizontal margin of current-element;
        if the current-element is center-positioned:
            now entry 1 of the origin of the current-element is the (width of the current window - image-width of image-ID of current-element) / 2;
            [say "[current-element]: Width of window: [width of current window]; image: [image-width of image-ID of current-element]; horizontal margin: [horizontal margin of current-element].";]
        if the current-element is top-positioned:
            now entry 2 of the origin of the current-element is vertical margin of current-element;
        if the current-element is bottom-positioned:
            now entry 2 of the origin of the current-element is the height of the current window - (image-height of image-ID of current-element + vertical margin of current-element);
            [say "[current-element]: Height of window: [height of current window]; image: [image-height of image-ID of current-element]; vertical margin: [vertical margin of current-element].";]
        if the current-element is central-positioned:
            now entry 2 of the origin of the current-element is the (height of the current window - image-height of image-ID of current-element) / 2;
        [say "[current-element] is placed at [origin of current-element].";]
        continue.

    Last element scaling rule for the UI-frame (this is the UI-frame arranging rule):
        let instance be 0;
        repeat with current-element running through display-active UI-buttons:
            increase instance by 1;
            now entry 1 of the origin of current-element is (entry 1 of the origin of the UI-frame) + (entry instance of the UI-frame offsets of the UI-frame);
            increase instance by 1;
            now entry 2 of the origin of current-element is (entry 2 of the origin of the UI-frame) + (entry instance of the UI-frame offsets of the UI-frame);
        exit.
        
    Last element scaling rule for a UI-element (this is the UI element scaling rule):
        do nothing;
        exit.