diff --git a/web/source/osk/layouts/targetedFloatLayout.ts b/web/source/osk/layouts/targetedFloatLayout.ts index de039411c3..df3fe9b08f 100644 --- a/web/source/osk/layouts/targetedFloatLayout.ts +++ b/web/source/osk/layouts/targetedFloatLayout.ts @@ -161,7 +161,7 @@ namespace com.keyman.osk.layouts { let newWidth = this.startWidth + cumulativeX; let newHeight = this.startHeight + cumulativeY; - + // Set the smallest and largest OSK size if(newWidth < 0.2*screen.width) { newWidth = 0.2*screen.width; diff --git a/web/source/osk/layouts/titleBar.ts b/web/source/osk/layouts/titleBar.ts index 26be9db8f2..3a772a257b 100644 --- a/web/source/osk/layouts/titleBar.ts +++ b/web/source/osk/layouts/titleBar.ts @@ -10,11 +10,37 @@ namespace com.keyman.osk.layouts { private _configButton: HTMLDivElement; private _caption: HTMLSpanElement; + private _helpEnabled: boolean; + private _configEnabled: boolean; + + public get helpEnabled(): boolean { + return this._helpEnabled; + } + + public set helpEnabled(val) { + this._helpEnabled = val; + + this._helpButton.style.visibility = val ? 'visible' : 'hidden'; + } + + public get configEnabled(): boolean { + return this._configEnabled; + } + + public set configEnabled(val) { + this._configEnabled = val; + + this._configButton.style.visibility = val ? 'visible' : 'hidden'; + } + private static readonly DISPLAY_HEIGHT = ParsedLengthStyle.inPixels(20); // As set in kmwosk.css public constructor(dragHandler?: MouseDragOperation) { this._element = this.buildTitleBar(); + this.helpEnabled = false; + this.configEnabled = false; + if(dragHandler) { this.element.onmousedown = dragHandler.mouseDownHandler; } diff --git a/web/source/osk/oskView.ts b/web/source/osk/oskView.ts index c9769f14df..83d4e5e288 100644 --- a/web/source/osk/oskView.ts +++ b/web/source/osk/oskView.ts @@ -1078,6 +1078,20 @@ namespace com.keyman.osk { * Description Wrapper function to add and identify OSK-specific event handlers */ ['addEventListener'](event: string, func: (obj) => boolean) { + // As the following title bar buttons (for desktop / FloatingOSKView) do nothing unless + // a site designer uses these events, we disable / hide them until an event is attached. + let titleBar = this.headerView; + if(titleBar && titleBar instanceof layouts.TitleBar) { + switch(event) { + case 'configclick': + titleBar.configEnabled = true; + break; + case 'helpclick': + titleBar.helpEnabled = true; + break; + } + } + return com.keyman.singleton.util.addEventListener('osk.'+event, func); } }