diff --git a/public/images/views.png b/public/images/views.png index ff655385..0bfc890c 100644 Binary files a/public/images/views.png and b/public/images/views.png differ diff --git a/public/scripts/agent-desktop-0.0.2-min.js b/public/scripts/agent-desktop-0.0.2-min.js index cb057eb3..2cbf2afe 100644 --- a/public/scripts/agent-desktop-0.0.2-min.js +++ b/public/scripts/agent-desktop-0.0.2-min.js @@ -1 +1 @@ -Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:function(e,t){return new Uint8Array(Array.prototype.slice.call(this,e,t))}});var CreateAgentRemoteDesktop=function(e,t){var l={};"string"==typeof(l.CanvasId=e)&&(l.CanvasId=Q(e)),l.Canvas=l.CanvasId.getContext("2d"),l.scrolldiv=t,l.State=0,l.PendingOperations=[],l.tilesReceived=0,l.TilesDrawn=0,l.KillDraw=0,l.ipad=!1,l.tabletKeyboardVisible=!1,l.LastX=0,l.LastY=0,l.touchenabled=0,l.submenuoffset=0,l.touchtimer=null,l.TouchArray={},l.connectmode=0,l.connectioncount=0,l.rotation=0,l.protocol=2,l.debugmode=0,l.firstUpKeys=[],l.stopInput=!1,l.localKeyMap=!0,l.remoteKeyMap=!1,l.pressedKeys=[],l.sessionid=0,l.username,l.oldie=!1,l.CompressionLevel=50,l.ScalingLevel=1024,l.FrameRateTimer=100,l.SwapMouse=!1,l.FirstDraw=!1,l.ScreenWidth=960,l.ScreenHeight=701,l.width=960,l.height=960,l.displays=null,l.selectedDisplay=null,l.onScreenSizeChange=null,l.onMessage=null,l.onConnectCountChanged=null,l.onDebugMessage=null,l.onTouchEnabledChanged=null,l.onDisplayinfo=null;var h=!(l.accumulator=null),g="default";l.mouseCursorActive=function(e){h!=e&&(h=e,l.CanvasId.style.cursor=1==e?g:"default")};var p=["default","progress","crosshair","pointer","help","text","no-drop","move","nesw-resize","ns-resize","nwse-resize","w-resize","alias","wait","none","not-allowed","col-resize","row-resize","copy","zoom-in","zoom-out"];l.Start=function(){l.State=0,l.accumulator=null},l.Stop=function(){l.setRotation(0),l.UnGrabKeyInput(),l.UnGrabMouseInput(),l.touchenabled=0,null!=l.onScreenSizeChange&&l.onScreenSizeChange(l,l.ScreenWidth,l.ScreenHeight,l.CanvasId),l.Canvas.clearRect(0,0,l.CanvasId.width,l.CanvasId.height)},l.xxStateChange=function(e){l.State!=e&&(l.State=e,l.CanvasId.style.cursor="default",0===e&&l.Stop())},l.send=function(e){2>32)+l.intToStr(32&o)):(l.recordedSize+=n.length,l.shortToStr(e)+l.shortToStr(t)+l.intToStr(n.length)+l.intToStr(o>>32)+l.intToStr(32&o)+n)}return l.SendKeyMsg=function(e,t){var n;null!=e&&((t=t||window.event).code&&0==l.localKeyMap?null!=(n=(n=t).code.startsWith("Key")&&4==n.code.length?n.code.charCodeAt(3):n.code.startsWith("Digit")&&6==n.code.length?n.code.charCodeAt(5):n.code.startsWith("Numpad")&&7==n.code.length?n.code.charCodeAt(6)+48:o[n.code])&&l.SendKeyMsgKC(e,n):(59==(n=t.keyCode)?n=186:173==n?n=189:61==n&&(n=187),l.SendKeyMsgKC(e,n)))},l.SendMessage=function(e){3==l.State&&l.send(String.fromCharCode(0,17)+l.shortToStr(4+e.length)+e)},l.SendKeyMsgKC=function(e,t){if(3==l.State)if("object"==typeof e)for(var n in e)l.SendKeyMsgKC(e[n][0],e[n][1]);else 1==e?-1==l.pressedKeys.indexOf(t)&&l.pressedKeys.unshift(t):2==e&&-1!=(n=l.pressedKeys.indexOf(t))&&l.pressedKeys.splice(n,1),0>8),255-(255&Math.abs(r))):(s=r>>8,255&r),String.fromCharCode(0,l.InputType.MOUSE,0,12,0,0,n/256&255,255&n,o/256&255,255&o,s,t)):String.fromCharCode(0,l.InputType.MOUSE,0,10,0,e==l.KeyAction.DOWN?a:2*a&255,n/256&255,255&n,o/256&255,255&o),l.Action==l.KeyAction.NONE?0==l.Alternate||l.ipad?(l.send(i),l.Alternate=1):l.Alternate=0:l.send(i)))},l.GetDisplayNumbers=function(){l.send(String.fromCharCode(0,11,0,4))},l.SetDisplay=function(e){l.send(String.fromCharCode(0,12,0,6,e>>8,255&e))},l.intToStr=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},l.shortToStr=function(e){return String.fromCharCode(e>>8&255,255&e)},l.onResize=function(){0!=l.ScreenWidth&&0!=l.ScreenHeight&&(l.Canvas.canvas.width==l.ScreenWidth&&l.Canvas.canvas.height==l.ScreenHeight||(l.FirstDraw&&(l.Canvas.canvas.width=l.ScreenWidth,l.Canvas.canvas.height=l.ScreenHeight,l.Canvas.fillRect(0,0,l.ScreenWidth,l.ScreenHeight),null!=l.onScreenSizeChange&&l.onScreenSizeChange(l,l.ScreenWidth,l.ScreenHeight,l.CanvasId)),l.FirstDraw=!1,1>32)+d.intToStr(32&o)):(d.recordedSize+=n.length,d.shortToStr(e)+d.shortToStr(t)+d.intToStr(n.length)+d.intToStr(o>>32)+d.intToStr(32&o)+n)}return d.SendKeyMsg=function(e,t){var n;null!=e&&((t=t||window.event).code&&0==d.localKeyMap?null!=(n=(n=t).code.startsWith("Key")&&4==n.code.length?n.code.charCodeAt(3):n.code.startsWith("Digit")&&6==n.code.length?n.code.charCodeAt(5):n.code.startsWith("Numpad")&&7==n.code.length?n.code.charCodeAt(6)+48:o[n.code])&&d.SendKeyMsgKC(e,n):(59==(n=t.keyCode)?n=186:173==n?n=189:61==n&&(n=187),d.SendKeyMsgKC(e,n)))},d.SendMessage=function(e){3==d.State&&d.send(String.fromCharCode(0,17)+d.shortToStr(4+e.length)+e)},d.SendKeyMsgKC=function(e,t){if(3==d.State)if("object"==typeof e)for(var n in e)d.SendKeyMsgKC(e[n][0],e[n][1]);else 1==e?-1==d.pressedKeys.indexOf(t)&&d.pressedKeys.unshift(t):2==e&&-1!=(n=d.pressedKeys.indexOf(t))&&d.pressedKeys.splice(n,1),0>8),255-(255&Math.abs(r))):(s=r>>8,255&r),String.fromCharCode(0,d.InputType.MOUSE,0,12,0,0,n/256&255,255&n,o/256&255,255&o,s,t)):String.fromCharCode(0,d.InputType.MOUSE,0,10,0,e==d.KeyAction.DOWN?a:2*a&255,n/256&255,255&n,o/256&255,255&o),d.Action==d.KeyAction.NONE?0==d.Alternate||d.ipad?(d.send(i),d.Alternate=1):d.Alternate=0:d.send(i)))},d.GetDisplayNumbers=function(){d.send(String.fromCharCode(0,11,0,4))},d.SetDisplay=function(e){d.send(String.fromCharCode(0,12,0,6,e>>8,255&e))},d.intToStr=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},d.shortToStr=function(e){return String.fromCharCode(e>>8&255,255&e)},d.onResize=function(){0!=d.ScreenWidth&&0!=d.ScreenHeight&&(d.Canvas.canvas.width==d.ScreenWidth&&d.Canvas.canvas.height==d.ScreenHeight||(d.FirstDraw&&(d.Canvas.canvas.width=d.ScreenWidth,d.Canvas.canvas.height=d.ScreenHeight,d.Canvas.fillRect(0,0,d.ScreenWidth,d.ScreenHeight),null!=d.onScreenSizeChange&&d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)),d.FirstDraw=!1,1 0) { obj.PendingOperations.shift(); } obj.SendCompressionLevel(1); obj.SendUnPause(); + // No need to event the display size change now, it will be evented on first draw. if (obj.onScreenSizeChange != null) { obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); } } @@ -520,7 +521,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) { obj.Canvas.canvas.width = obj.ScreenWidth; obj.Canvas.canvas.height = obj.ScreenHeight; obj.Canvas.fillRect(0, 0, obj.ScreenWidth, obj.ScreenHeight); - if (obj.onScreenSizeChange != null) obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); + if (obj.onScreenSizeChange != null) { obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); } } obj.FirstDraw = false; if (obj.debugmode > 1) { console.log("onResize: " + obj.ScreenWidth + " x " + obj.ScreenHeight); } @@ -789,7 +790,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) { obj.ScreenWidth = obj.Canvas.canvas.width; obj.ScreenHeight = obj.Canvas.canvas.height; - if (obj.onScreenSizeChange != null) obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); + if (obj.onScreenSizeChange != null) { console.log('s4', obj.ScreenWidth, obj.ScreenHeight); obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); } return true; } diff --git a/public/styles/style.css b/public/styles/style.css index 701955ff..f91ca37a 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -2851,6 +2851,14 @@ a { width: 28px; } +.viewSelector7 { + margin-left: 2px; + margin-top: 2px; + background: url(../images/views.png) -364px 0px; + height: 28px; + width: 28px; +} + .fulldesk .viewSelector5 { background: url(../images/views.png) -252px 0px; } diff --git a/translate/translate.json b/translate/translate.json index a32073ab..a49800eb 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -11945,10 +11945,17 @@ "zh-chs": "台式机", "zh-cht": "台式電腦", "xloc": [ - "default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarView->viewselect->5", + "default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarView->viewselect->9", + "default.handlebars->container->column_l->p1->p1title->devListToolbarViewIcons", "default.handlebars->container->column_l->p1->p1title->devListToolbarViewIcons" ] }, + { + "en": "Desktops Fixed Width", + "xloc": [ + "default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarView->viewselect->5" + ] + }, { "cs": "Podrobnosti", "de": "Details", diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index ef3e22ec..a448ed13 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -1497,6 +1497,20 @@ updateDeviceDetails(getNodeFromId(message.nodeid), null, message); break; } + case 'getNotes': { + var n = Q('d2devNotes'); + if (n && (message.id == decodeURIComponent(n.attributes['noteid'].value))) { + if (message.notes) { QH('d2devNotes', decodeURIComponent(message.notes)); } else { QH('d2devNotes', ''); } + var ro = (n.attributes['ro'].value == 'true'); + if (ro == false) { // If we have permissions, set read/write on this note. + n.removeAttribute('readonly'); + QE('idx_dlgOkButton', true); + QV('idx_dlgOkButton', true); + focusTextBox('d2devNotes'); + } + } + break; + } case 'otpauth-request': { if ((xxdialogMode == 2) && (xxdialogTag == 'otpauth-request')) { var secret = message.secret; @@ -3244,8 +3258,9 @@ x += '
'; x += ''; - //x += ''; + x += ''; //if ((connectivity & 1) && (meshrights & 8) && (node.agent.id < 5)) { x += ''; } + QH('p10html', x); // Show node last 7 days timeline @@ -3355,6 +3370,16 @@ setDialogMode(2, "Device Action", (count == 0) ? 1 : 3, deviceActionFunctionEx, x); } + function showNotes(readonly, noteid) { + if (xxdialogMode) return; + var x = ''; + if (noteid.startsWith('node%2F%2F')) { x += '' + "Device group notes can be viewed and changed by other device group administrators." + ''; } + setDialogMode(2, "Notes", 2, showNotesEx, x, noteid); + meshserver.send({ action: 'getNotes', id: decodeURIComponent(noteid) }); + } + + function showNotesEx(buttons, tag) { meshserver.send({ action: 'setNotes', id: decodeURIComponent(tag), notes: encodeURIComponentEx(Q('d2devNotes').value) }); } + function deviceChat(e) { if (xxdialogMode) return; setDialogMode(2, "Device Action", 3, function () { @@ -5107,7 +5132,7 @@ x += addHtmlValue("Type", meshtype); //x += addHtmlValue('Identifier', currentMesh._id.split('/')[2]); - //x += '
'; + x += '
'; x += '

'; var currentMeshLinks = currentMesh.links[userinfo._id]; diff --git a/views/default.handlebars b/views/default.handlebars index 41c8ae7a..de9aa10c 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -238,6 +238,7 @@
+

My Devices

@@ -283,8 +284,9 @@ '; } // Close collapse div + if (((view == 1) || (view == 3) || (view == 5)) && (current != null)) { r += ''; } // Close collapse div deviceHeaderSet(); var extra = ''; if (view == 2) { r += ''; } @@ -3574,7 +3576,7 @@ r += '
'; r += '' + extra; r += ''; - if ((view == 1) || (view == 2) || (view == 3)) { + if ((view == 1) || (view == 2) || (view == 3) || (view == 5)) { var collapsed = CollapsedGroups[node.meshid]; r += ''; // Collapse action } @@ -3588,19 +3590,19 @@ if (view == 2) { r += '
'; } displayedMeshes[current] = 1; c = 0; - if ((view == 1) || (view == 3)) { r += '
'; } // Open collapse div + if ((view == 1) || (view == 3) || (view == 5)) { r += '
'; } // Open collapse div } } else if (sort == 1) { // Power header var pwr = node.pwr?node.pwr:0; if (pwr !== current) { - if (((view == 1) || (view == 3)) && (current != null)) { r += '
'; } // Close collapse div + if (((view == 1) || (view == 3) || (view == 5)) && (current != null)) { r += '
'; } // Close collapse div deviceHeaderSet(); if ((view == 1) && (current !== null)) { if (c == 2) { r += '
'; } if (r != '') { r += ''; } } if (view == 2) { r += ''; } r += '
'; - if ((view == 1) || (view == 2) || (view == 3)) { + if ((view == 1) || (view == 2) || (view == 3) || (view == 5)) { var collapsed = CollapsedGroups['pwr:' + pwr]; r += ''; // Collapse action } @@ -3608,7 +3610,7 @@ current = pwr; c = 0; - if ((view == 1) || (view == 3)) { r += '
'; } // Open collapse div + if ((view == 1) || (view == 3) || (view == 5)) { r += '
'; } // Open collapse div } } else if (sort == 2) { // Device header @@ -3626,10 +3628,10 @@ else if ((sort == 3) || (sort == 4)) { collapseName = 'tag:**xx**xx*TaG*xx**xx**'; } var collapsed = (sort != 3) & (sort != 4) & CollapsedGroups[collapseName]; r += ''; - } else if ((view == 3) && (node.conn & 1) && (((meshrights & 8) || (meshrights & 256)) != 0) && ((node.agent.caps & 1) != 0)) { // Check if we have rights and agent is capable of KVM. + } else if (((view == 3) || (view == 5)) && (node.conn & 1) && (((meshrights & 8) || (meshrights & 256)) != 0) && ((node.agent.caps & 1) != 0)) { // Check if we have rights and agent is capable of KVM. // Draw the device (TODO: See if we can replace this with a standin in the future) if ((Object.keys(checkedNodeids).length == 0) || checkedNodeids[node._id]) { - r += updateDeviceViewHtml(3, null, node); + r += updateDeviceViewHtml(view, null, node); kvmDivs.push(node._id); } } @@ -3643,7 +3645,7 @@ var collapsed = CollapsedGroups['tag:' + tag]; var r2 = r.replace('**xx**xx*TaG*xx**xx**', encodeURIComponentEx(tag) + (collapsed?' style=display:none':'')); if (groups[tag] == null) { groups[tag] = r2; groupCount[tag] = 1; } else { groups[tag] += r2; groupCount[tag] += 1; } - if (view == 3) break; + if ((view == 3) || (view == 5)) break; } } r = ''; @@ -3762,21 +3764,24 @@ p1updateInfo(); // Take care of KVM surfaces in desktop view mode - if ((view == 3) && (xxcurrentView == 1)) { + if (((view == 3) || (view == 5)) && (xxcurrentView == 1)) { + // Figure out and adjust the size to fill the width of the div var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex]; - //var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw); - var realw = vsize.x + 2, tw = totalDeviceViewWidth - 5, xw = Math.floor(tw / realw); - xw = realw + Math.floor((tw - (xw * realw)) / xw); - vsize.y = vsize.y * (xw / vsize.x); - vsize.x = xw; + if ((view == 3)) { // If we are in fixed width mode, correct the size for the screen width. + var realw = vsize.x + 2, tw = totalDeviceViewWidth - 5, xw = Math.floor(tw / realw); + xw = realw + Math.floor((tw - (xw * realw)) / xw); + vsize.y = vsize.y * (xw / vsize.x); + vsize.x = xw; + } for (var i in multiDesktop) { multiDesktop[i].xxdelete = true; } for (var i in kvmDivs) { var id = kvmDivs[i], shortid = id.split('/')[2], desk = multiDesktop[id]; if (desk != null) { // This device already has a canvas, use it. - desk.m.CanvasId.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px'); + var width = (view == 5)?((desk.m.width * vsize.y) / desk.m.height):vsize.x; + desk.m.CanvasId.setAttribute('style', 'background-color:black;width:' + width + 'px;height:' + vsize.y + 'px'); Q('xkvmid_' + shortid).appendChild(desk.m.CanvasId); delete desk.xxdelete; QH('skvmid_' + shortid, ["Disconnected", "Connecting...", "Setup...", '', ''][((desk.m.State == null)?desk.m.state:desk.m.State)]); @@ -3785,8 +3790,9 @@ if ((desktopNode == node) && (desktop != null)) { // Check if the main desktop is this device, if it is, use that. // This device already has a canvas, use it. var c = desktop.m.CanvasId; + var width = (view == 5)?((desktop.m.width * vsize.y) / desktop.m.height):vsize.x; c.setAttribute('id', 'kvmid_' + shortid); - c.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px'); + c.setAttribute('style', 'background-color:black;width:' + width + 'px;height:' + vsize.y + 'px'); c.setAttribute('onclick', 'toggleKvmDevice(\'' + id + '\')'); c.removeAttribute('onmousedown'); c.removeAttribute('onmouseup'); @@ -3977,12 +3983,12 @@ r += '
' + name + '
' + devNotify + ''; r += '' + getUserShortStr(node) + '' + (node.ip != null ? node.ip : '') + '' + states.join(' + '); div.innerHTML = r; - } else if (view == 3) { + } else if ((view == 3) || (view == 5)) { // Draw the device and canvas var r = '
' + devNotify; //r += ''; r += '
 ' + name + '
'; - r += '
' + "Disconnected" + '
'; + r += '
' + "Disconnected" + '
'; r += '
'; return r; } @@ -4164,8 +4170,7 @@ desk.m.useZRLE = true; desk.m.showmouse = true; desk.m.onKvmData = function (data) { console.log('KVM Data received in multi-desktop mode, this is not supported.'); }; // KVM Data Channel not supported in multi-desktop right now. - //desk.m.onScreenSizeChange = deskAdjust; - if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust + desk.m.onScreenSizeChange = mdeskAdjust; // Multi-Desktop Adjust desk.Start(nodeid, 16994, '*', '*', 0); desk.contype = 2; multiDesktop[nodeid] = desk; @@ -4183,8 +4188,8 @@ if (multidesktopsettings.swapmouse) { desk.m.SwapMouse = multidesktopsettings.swapmouse; } if (multidesktopsettings.remotekeymap == true) { desk.m.remoteKeyMap = multidesktopsettings.remotekeymap; } //desk.m.onDisplayinfo = deskDisplayInfo; - //desk.m.onScreenSizeChange = deskAdjust; - if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust + desk.m.onScreenSizeChange = mdeskAdjust; // Multi-Desktop Adjust + //if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } desk.Start(nodeid); desk.contype = 1; multiDesktop[nodeid] = desk; @@ -7121,7 +7126,7 @@ QV('d7meshkvm', (webRtcDesktop) || ((currentNode.agent != null) && (currentNode.agent.caps & 1) && ((deskState == false) || (desktop.contype == 1)))); // Enable buttons - var inputAllowed = (currentNode.agent.id != 14) && ((rights == 0xFFFFFFFF) || (((rights & 8) != 0) && ((rights & 256) == 0) && ((rights & 4096) == 0))); + var inputAllowed = ((currentNode.agent == null) || (currentNode.agent.id != 14)) && ((rights == 0xFFFFFFFF) || (((rights & 8) != 0) && ((rights & 256) == 0) && ((rights & 4096) == 0))); var online = ((currentNode.conn & 1) != 0); // If Agent (1) connected, enable remote desktop QE('connectbutton1', online); var hwonline = ((currentNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal @@ -7561,6 +7566,7 @@ } function deskAdjust() { + //if (xxcurrentView == 1) return; var parentH = Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth; var deskH = Q('Desk').height, deskW = Q('Desk').width; @@ -7582,10 +7588,10 @@ if ((parentH / parentW) > (deskH / deskW)) { var hNew = ((deskH * parentW) / deskW) + 'px'; //if (webPageFullScreen || fullscreen) { - //QS('deskarea3x').height = null; + // QS('deskarea3x').height = null; //} else { - // QS('deskarea3x').height = hNew; - //QS('deskarea3x').height = null; + // QS('deskarea3x').height = hNew; + // QS('deskarea3x').height = null; //} QS('Desk').height = hNew; QS('Desk').width = '100%'; @@ -7603,24 +7609,20 @@ } } - function mdeskAdjust(mod, sw, sh, cv) { - if (!mod || !sw || !sh || !cv) return; + function mdeskAdjust(module, sw, sh, cv) { + if (!module || !sw || !sh || !cv) return; + var view = Q('viewselect').value; + if ((view != 3) && (view != 5)) return; // Check if we are in single desktop mode if (cv.id == 'Desk') { deskAdjust(); return; } - // Figure out and adjust the size to fill the width of the div - var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex]; - var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw); - xw = realw + Math.floor((tw - (xw * realw)) / xw); - vsize.y = vsize.y * (xw / vsize.x); - vsize.x = xw; - var mh = vsize.y, mw = vsize.x; - if (mod.State != 0) { mh = vsize.y; mw = (sw / sh) * vsize.y; } - QS(cv.id)['max-height'] = mh + 'px'; - QS(cv.id)['max-width'] = mw + 'px'; - QS(cv.id)['margin-top'] = '0'; - QS(cv.id)['margin-bottom'] = '0'; + if (view == 5) { // If not in fixed width mode, compute the with + var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex]; + QS(cv.id)['width'] = ((module.State != 0)?((sw * vsize.y) / sh):(vsize.x)) + 'px'; + } + QS(cv.id)['margin-top'] = null; + QS(cv.id)['margin-bottom'] = null; } // Press ESC key