Skip to content

Commit

Permalink
fix(web): DRYing it out re: app/browser's version
Browse files Browse the repository at this point in the history
  • Loading branch information
jahorton committed Nov 21, 2023
1 parent e109ec7 commit f6e3847
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 45 deletions.
4 changes: 2 additions & 2 deletions web/src/app/browser/src/languageMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class LanguageMenu {
if(device.OS == 'ios') {
if(device.formFactor == 'phone') {
barWidth=(landscapeView() ? 36 : 0);
maxHeight=(window.innerHeight-barWidth-16)*util.getViewportScale();
maxHeight=(window.innerHeight-barWidth-16)*util.getViewportScale(device.formFactor);
} else if(device.formFactor == 'tablet') {
barWidth=(landscapeView() ? 16 : 0);
maxHeight=(maxHeight-barWidth);
Expand Down Expand Up @@ -316,7 +316,7 @@ export class LanguageMenu {
langs.sort();

// Get current scale factor (reciprocal of viewport scale)
var scale=Math.round(100/util.getViewportScale())/100;
var scale=Math.round(100/util.getViewportScale(device.formFactor))/100;

var dx,lgBar,i,kb,activeLanguageIndex=-1;
for(k=0; k<langs.length; k++) {
Expand Down
42 changes: 0 additions & 42 deletions web/src/app/browser/src/utils/getViewportScale.ts

This file was deleted.

2 changes: 1 addition & 1 deletion web/src/app/browser/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { AlertHost } from './alertHost.js';
export { _CreateElement } from './createElement.js';
export { getStyleValue } from './getStyleValue.js';
export { getViewportScale } from './getViewportScale.js';
export { getViewportScale } from 'keyman/engine/osk';
export { whenDocumentReady } from './documentReady.js';
2 changes: 2 additions & 0 deletions web/src/engine/osk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export { type OSKKeySpec } from './keyboard-layout/oskKey.js';
export { type default as InputEventCoordinate } from './input/inputEventCoordinate.js';
export { type default as EmbeddedGestureConfig } from './config/embeddedGestureConfig.js';

export { getViewportScale } from './screenUtils.js';

export { default as Activator, StaticActivator } from './views/activator.js';
export { default as SimpleActivator } from './views/simpleActivator.js';
export { default as TwoStateActivator } from './views/twoStateActivator.js';
Expand Down

0 comments on commit f6e3847

Please sign in to comment.