src/ContextControl.js
/**
 *
 * @constructor
 * @extends SimpleEventDispatcher
 * @param {number} [horizontalOffset={@link ContextControl.defaultHorizontalOffset}] Horizontal offset with respect to offset element passed to {@link ContextControl#open}.
 * @param {number} [verticalOffset={@link ContextControl.defaultVerticalOffset}] Vertical offset with respect to offset element passed to {@link ContextControl#open}.
 * @classdesc
 *
 * Simple implementation of an HTML DOM based context control. This class (lazily) creates a blank `HTMLDivElement` to hold the control's content, and applies class
 * names corresponding to when the control is opened or closed. The control also repositions itself when the window is resized.
 * 
 * The first time a control is {@link ContextControl#open opened}, the {@link ContextControl#event:create create} event is fired. It is expected client code
 * will listen for this event and populate the control's element with desired content. The control's element can be obtained in such a listener via
 * `{@link ContextControl#getControlElement event.target.getControlElement()}`.
 * 
 * Upon being {@link ContextControl#open opened}, this class will begin listening for window resize events and {@link ContextControl#position position} itself upon
 * receiving them. Upon being {@link ContextControl#close closed}, this class will stop listening for resize events.
 * 
 * Of note, this class *only* sets element class names, and a limited set of CSS properties; most styling should be handled by dedicated stylesheets. The following is a baseline
 * stylesheet that uses the default class names:
 *
 * ``` css
 * .context-control {
 *     position: absolute;
 *     opacity: 0;
 *     color: black;
 *     background-color: white;
 *     border: 1px solid black;
 *     padding: .5em;
 * }
 * 
 * .context-control.context-control-opened {
 *     opacity: 1;
 *     transition: opacity .5s;
 * }
 * 
 * .context-control.context-control-closed {
 *     display: none;
 * }
 * ```
 */
@constructor
@extends SimpleEventDispatcher
@param {number} [horizontalOffset= ContextControl.defaultHorizontalOffset] Horizontal offset with respect to offset element passed to  ContextControl#open.
@param {number} [verticalOffset= ContextControl.defaultVerticalOffset] Vertical offset with respect to offset element passed to  ContextControl#open.
@classdesc

Simple implementation of an HTML DOM based context control. This class (lazily) creates a blank `HTMLDivElement` to hold the control's content, and applies class
names corresponding to when the control is opened or closed. The control also repositions itself when the window is resized.

The first time a control is  ContextControl#open opened, the  ContextControl#event:create create event is fired. It is expected client code
will listen for this event and populate the control's element with desired content. The control's element can be obtained in such a listener via
` ContextControl#getControlElement event.target.getControlElement()`.

Upon being  ContextControl#open opened, this class will begin listening for window resize events and  ContextControl#position position itself upon
receiving them. Upon being  ContextControl#close closed, this class will stop listening for resize events.

Of note, this class *only* sets element class names, and a limited set of CSS properties; most styling should be handled by dedicated stylesheets. The following is a baseline
stylesheet that uses the default class names.



.context-control.context-control-opened {
opacity: 1;
transition: opacity .5s;
}

.context-control.context-control-closed {
display: none;
}
```
@constructor @extends SimpleEventDispatcher @param { number } [ horizontalOffset = ContextControl . defaultHorizontalOffset ] Horizontal offset with respect to offset element passed to ContextControl#open . @param { number } [ verticalOffset = ContextControl . defaultVerticalOffset ] Vertical offset with respect to offset element passed to ContextControl#open . @classdesc Simple implementation of an HTML DOM based context control . This class ( lazily ) creates a blank ` HTMLDivElement ` to hold the control ' s content and applies class names corresponding to when the control is opened or closed . The control also repositions itself when the window is resized . The first time a control is ContextControl#open opened the ContextControl#event : create create event is fired . It is expected client code will listen for this event and populate the control ' s element with desired content . The control ' s element can be obtained in such a listener via ` ContextControl#getControlElement event . target . getControlElement () ` . Upon being ContextControl#open opened this class will begin listening for window resize events and ContextControl#position position itself upon receiving them . Upon being ContextControl#close closed this class will stop listening for resize events . Of note this class * only * sets element class names and a limited set of CSS properties ; most styling should be handled by dedicated stylesheets . The following is a baseline stylesheet that uses the default class names . . context - control . context - control - opened { opacity : 1 ; transition : opacity . 5s ; } . context - control . context - control - closed { display : none ; } ` ` `
function ContextControl(horizontalOffset, verticalOffset) {
    'use strict';
    SimpleEventDispatcher.call(this);
    this.horizontalOffset = horizontalOffset !== 0 && !horizontalOffset ? ContextControl.defaultHorizontalOffset : horizontalOffset;
    this.verticalOffset = verticalOffset !== 0 && !verticalOffset ? ContextControl.defaultVerticalOffset : verticalOffset;
}
function ContextControl ( horizontalOffset , verticalOffset ) { 'use strict' ; SimpleEventDispatcher . call ( this ) ; this . horizontalOffset = horizontalOffset !== 0 && ! horizontalOffset ? ContextControl . defaultHorizontalOffset : horizontalOffset ; this . verticalOffset = verticalOffset !== 0 && ! verticalOffset ? ContextControl . defaultVerticalOffset : verticalOffset ; }
@constructor
 @extends SimpleEventDispatcher
 @param {number} [horizontalOffset={@link ContextControl.defaultHorizontalOffset}] Horizontal offset with respect to offset element passed to {@link ContextControl#open}.
@constructor @extends SimpleEventDispatcher @param { number } [ horizontalOffset = { @link ContextControl . defaultHorizontalOffset } ] Horizontal offset with respect to offset element passed to { @link ContextControl#open } .
/**
     * The offset in pixels to be applied to the `left` `CSSStyleDeclaration` of this control's element with respect
     * to the current offset element (last passed to {@link ContextControl#open}).
     *
     * @type {number}
     */ /**
     * The offset in pixels to be applied to the `top` `CSSStyleDeclaration` of this control's element with respect
     * to the current offset element (last passed to {@link ContextControl#open}).
     *
     * @type {number}
     */