mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-25 09:07:40 +00:00
change(web): titlebar configEnabled, helpEnabled
This commit is contained in:
parent
9301626dd2
commit
a7e01f9172
3 changed files with 41 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue