GUAC-1170: Restore support for gaps within the OSK.

This commit is contained in:
Michael Jumper
2015-04-28 20:37:32 -07:00
parent 741d25291f
commit fa130a8e25

View File

@@ -475,12 +475,16 @@ Guacamole.OnScreenKeyboard = function(layout) {
* first be transformed into the C-style hexadecimal literal for the * first be transformed into the C-style hexadecimal literal for the
* Unicode codepoint of that character. For example, the key "A" would * Unicode codepoint of that character. For example, the key "A" would
* become "guac-keyboard-key-0x41". * become "guac-keyboard-key-0x41".
*
* If the layout structure object is a number, a gap of that size will be
* inserted. The gap will be given the CSS class "guac-keyboard-gap", and
* will be scaled according to the same size units as each key.
* *
* @private * @private
* @param {Element} element * @param {Element} element
* The element to append elements to. * The element to append elements to.
* *
* @param {Array|Object|String} object * @param {Array|Object|String|Number} object
* The layout structure object to use when constructing the elements to * The layout structure object to use when constructing the elements to
* append. * append.
* *
@@ -525,6 +529,17 @@ Guacamole.OnScreenKeyboard = function(layout) {
} }
// If a number, create as a gap
else if (typeof object === 'number') {
// Add gap class
addClass(div, 'guac-keyboard-gap');
// Maintain scale
scaledElements.push(new ScaledElement(div, object, object));
}
// If a string, create as a key // If a string, create as a key
else if (typeof object === 'string') { else if (typeof object === 'string') {
@@ -626,7 +641,9 @@ Guacamole.OnScreenKeyboard.Layout = function(template) {
* layout will be traversed to produce an identically-nested grouping of * layout will be traversed to produce an identically-nested grouping of
* keys in the DOM tree. All strings will be transformed into their * keys in the DOM tree. All strings will be transformed into their
* corresponding sets of keys, while all objects and arrays will be * corresponding sets of keys, while all objects and arrays will be
* transformed into named groups and anonymous groups respectively. * transformed into named groups and anonymous groups respectively. Any
* numbers present will be transformed into gaps of that size, scaled
* according to the same units as each key.
* *
* @type Object * @type Object
*/ */