namespace com.keyman.osk { class ActiveRow implements LayoutRow { // Identify key labels (e.g. *Shift*) that require the special OSK font static readonly SPECIAL_LABEL=/\*\w+\*/; // Defines key defaults static readonly DEFAULT_KEY = { text: '', width: '100', sp: '0', pad: '15' }; id: string; key: LayoutKey[]; totalWidth: number; private constructor() { } static polyfill(row: LayoutRow, totalWidth: number) { // Apply defaults, setting the width and other undefined properties for each key let keys=row['key']; for(let j=0; j 0) { let j=keys.length-1; padPercent=parseInt(keys[j]['pad'],10)/totalWidth; keys[j]['padpc']=padPercent; totalPercent += padPercent; keys[j]['widthpc']=1-totalPercent; } // Add class functions to the existing layout object, allowing it to act as an ActiveLayout. let dummy = new ActiveRow(); for(let key in dummy) { if(!row.hasOwnProperty(key)) { row[key] = dummy[key]; } } (row as ActiveRow).totalWidth = totalWidth; } } export class ActiveLayer implements LayoutLayer { row: ActiveRow[]; id: string; constructor() { } static polyfill(layer: LayoutLayer, formFactor: string) { layer.aligned=false; // Create a DIV for each row of the group let rows=layer['row']; // Calculate the maximum row width (in layout units) var totalWidth=0; for(let i=0; i totalWidth) { totalWidth = width; } } // Add default right margin if(formFactor == 'desktop') { totalWidth += 5; // KMEW-117 } else { // TODO: Not entirely clear why this needs to be 15 instead of 5 on touch layouts. We probably have // a miscalculation somewhere totalWidth += 15; } for(let i=0; i0; i--) { if(rows[i-1]['key'].length > 0) { break; } } if(i < rows.length) { rows.splice(i-rows.length,rows.length-i); } } // ...remove to here when compiler bug fixed *** for(n=0; n