Properly force clipping on touch

It shouldn't depend on what's saved in webstorage nor save the forced
value to webstorage.

Includes a revert of 0342e4f489
This commit is contained in:
Samuel Mannehed 2018-06-07 15:52:46 +02:00
parent 8f47bd296c
commit 11715f2092
1 changed files with 12 additions and 5 deletions

View File

@ -157,7 +157,7 @@ const UI = {
UI.initSetting('host', window.location.hostname); UI.initSetting('host', window.location.hostname);
UI.initSetting('port', port); UI.initSetting('port', port);
UI.initSetting('encrypt', (window.location.protocol === "https:")); UI.initSetting('encrypt', (window.location.protocol === "https:"));
UI.initSetting('view_clip', isTouchDevice); UI.initSetting('view_clip', false);
UI.initSetting('resize', 'off'); UI.initSetting('resize', 'off');
UI.initSetting('shared', true); UI.initSetting('shared', true);
UI.initSetting('view_only', false); UI.initSetting('view_only', false);
@ -728,6 +728,13 @@ const UI = {
return val; return val;
}, },
// Set the new value, update and disable form control setting
forceSetting: function(name, val) {
WebUtil.setSetting(name, val);
UI.updateSetting(name);
UI.disableSetting(name);
},
// Update cookie and form control setting. If value is not set, then // Update cookie and form control setting. If value is not set, then
// updates from control to current cookie setting. // updates from control to current cookie setting.
updateSetting: function(name) { updateSetting: function(name) {
@ -1257,12 +1264,12 @@ const UI = {
UI.updateViewDrag(); UI.updateViewDrag();
}, },
// Handle special cases where viewport clipping is forced on/off or locked // Handle special cases where viewport clipping is locked
enableDisableViewClip: function() { enableDisableViewClip: function() {
const resizeSetting = UI.getSetting('resize'); const resizeSetting = UI.getSetting('resize');
// Disable clipping if we are scaling, connected or on touch if (isTouchDevice) {
if (resizeSetting === 'scale' || UI.forceSetting('view_clip', true);
isTouchDevice) { } else if (resizeSetting === 'scale') {
UI.disableSetting('view_clip'); UI.disableSetting('view_clip');
} else { } else {
UI.enableSetting('view_clip'); UI.enableSetting('view_clip');