/// namespace com.keyman.osk { export class OSKLayer { public readonly element: HTMLDivElement; public readonly rows: OSKRow[]; public readonly spec: keyboards.ActiveLayer; public readonly nextlayer: string; public readonly globeKey: OSKBaseKey; public readonly spaceBarKey: OSKBaseKey; public readonly hideKey: OSKBaseKey; public readonly capsKey: OSKBaseKey; public readonly numKey: OSKBaseKey; public readonly scrollKey: OSKBaseKey; private _rowHeight: number; public get rowHeight(): number { return this._rowHeight; } public get id(): string { return this.spec.id; } public constructor(vkbd: VisualKeyboard, layout: keyboards.ActiveLayout, layer: keyboards.ActiveLayer) { this.spec = layer; const gDiv = this.element = document.createElement('div'); const gs=gDiv.style; gDiv.className='kmw-key-layer'; var nRows=layer['row'].length; if(nRows > 4 && vkbd.device.formFactor == 'phone') { gDiv.className = gDiv.className + ' kmw-5rows'; } // Set font for layer if defined in layout gs.fontFamily = 'font' in layout ? layout['font'] : ''; this.nextlayer = gDiv['layer'] = layer['id']; if(typeof layer['nextlayer'] == 'string') { // The gDiv['nextLayer'] is no longer referenced in KMW 15.0+, but is // maintained for partial back-compat in case any site devs actually // relied on its value from prior versions. // // We won't pay attention to any mutations to the gDiv copy, though. gDiv['nextLayer'] = this.nextlayer = layer['nextlayer']; } // Create a DIV for each row of the group let rows=layer['row']; this.rows = []; for(let i=0; i