[mapguide-commits] r6475 - trunk/MgDev/Web/src/viewerfiles
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Feb 1 21:45:39 EST 2012
Author: liuar
Date: 2012-02-01 18:45:38 -0800 (Wed, 01 Feb 2012)
New Revision: 6475
Modified:
trunk/MgDev/Web/src/viewerfiles/quickplot.js
trunk/MgDev/Web/src/viewerfiles/quickplotpreviewinner.templ
Log:
Submit on behalf of Mars Wu
Integrate r6474
Fix ticket: http://trac.osgeo.org/mapguide/ticket/1943 - Quick Plot: Preview layout of portrait map is not proper
The reason for tis is the preview dialog is automatically adjusted to fit the browser window. But it considered only the "width", not the height because Then consider also the height when adjust the size of the preview dialog
Modified: trunk/MgDev/Web/src/viewerfiles/quickplot.js
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/quickplot.js 2012-02-02 02:39:29 UTC (rev 6474)
+++ trunk/MgDev/Web/src/viewerfiles/quickplot.js 2012-02-02 02:45:38 UTC (rev 6475)
@@ -724,10 +724,10 @@
width:400,
height: 400,
content: '<table border="0" cellspacing="0" cellpadding="0" id="PreviewContainer">' +
- ' <tr>' +
- ' <td>' +
- ' <iframe id="PreviewFrame" scrolling="no" frameborder="0" style="border: 0px; width: 400px; height: 300px;" src="about:blank"></iframe>' +
- ' </td>' +
+ ' <tr>' +
+ ' <td>' +
+ ' <iframe id="PreviewFrame" scrolling="no" frameborder="0" style="border: 0px; width: 400px; height: 300px;" src="about:blank"></iframe>' +
+ ' </td>' +
' </tr>' +
'</table>'
});
@@ -823,22 +823,17 @@
var factor = 0.5;
this.previewContainer = $(this.innerDoc.getElementById("PreviewContainer"));
this.previewContainer.style.width = box.width * factor + "px";
- this.pictureContainer = $(this.innerDoc.getElementById("PictureContainer"));
- var pcBox = this.pictureContainer.getContentBoxSize();
+ this.resizePictureContainer();
- this.indicator = $(this.innerDoc.getElementById("ProgressIndicator"));
+ // Verify if the priview container "overflows" the visible screen area
+ var containerBox = this.previewContainer.getContentBoxSize();
+ if (containerBox.height > box.height)
+ {
+ var overhead = $(this.innerDoc.getElementById("legalNotice")).getMarginBoxSize().height + $(this.innerDoc.getElementById("AnnotationContainer")).getMarginBoxSize().height + 4 * this.previewContainer.cellSpacing;
+ this.previewContainer.style.width = containerBox.width * box.height / containerBox.height - overhead + "px";
+ this.resizePictureContainer();
+ }
- var paperSize = this.captureInfo.paperSize;
- this.paperSize = paperSize;
-
- var ratio = paperSize.w / paperSize.h;
-
- // Resize the indicator
- this.indicator.style.width = pcBox.width + "px";
- this.indicator.style.height = pcBox.width / ratio + "px";
- // Set a explicit size to the container
- this.pictureContainer.style.width = this.indicator.style.width;
- this.pictureContainer.style.height = this.indicator.style.height;
// Get the styles for the print picture
var rules = this.innerDoc.styleSheets[1].cssRules || this.innerDoc.styleSheets[1].rules;
this.previewStyle = rules[0];
@@ -910,6 +905,31 @@
}
},
+ resizePictureContainer: function()
+ {
+ this.innerDoc = this.previewFrame.contentWindow.document;
+
+ this.indicator = $(this.innerDoc.getElementById("ProgressIndicator"));
+ // Reset the size of the indicator first
+ this.indicator.style.width = "";
+ this.indicator.style.height = "";
+ // Reset the size of the picture container
+ this.pictureContainer = $(this.innerDoc.getElementById("PictureContainer"));
+ this.pictureContainer.style.width = "";
+ this.pictureContainer.style.height = "";
+
+ // Resize
+ var pcBox = this.pictureContainer.getContentBoxSize();
+ var ratio = this.captureInfo.paperSize.w / this.captureInfo.paperSize.h;
+
+ this.indicator.style.width = pcBox.width + "px";
+ this.indicator.style.height = pcBox.width / ratio + "px";
+
+ // Set an explicit size to the container
+ this.pictureContainer.style.width = this.indicator.style.width;
+ this.pictureContainer.style.height = this.indicator.style.height;
+ },
+
previewInnerLoaded: function()
{
this.previewInnerIsLoaded = true;
@@ -946,15 +966,15 @@
// Set the print size
// NOTE: It works only with a 96 dpi device dpi
var deviceDpi = 96;
- var idealSize = {width:(this.paperSize.w / 25.4 - 2 * this.printMargin) * deviceDpi, height:(this.paperSize.h / 25.4 - 2 * this.printMargin) * deviceDpi};
+ var idealSize = {width:(this.captureInfo.paperSize.w / 25.4 - 2 * this.printMargin) * deviceDpi, height:(this.captureInfo.paperSize.h / 25.4 - 2 * this.printMargin) * deviceDpi};
// Get the size of the print frame
var docSize = $(this.innerDoc.body).getContentBoxSize();
var realHeight = idealSize.height - (docSize.height - size.height);
- var realWidth = realHeight * this.paperSize.w / this.paperSize.h;
+ var realWidth = realHeight * this.captureInfo.paperSize.w / this.captureInfo.paperSize.h;
if (realWidth > idealSize.width)
{
realWidth = idealSize.width;
- realHeight = realWidth / (this.paperSize.w / this.paperSize.h);
+ realHeight = realWidth / (this.captureInfo.paperSize.w / this.captureInfo.paperSize.h);
}
this.printStyle.style.width = realWidth + "px";
Property changes on: trunk/MgDev/Web/src/viewerfiles/quickplot.js
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/adsk/2.2gp/Web/src/viewerfiles/quickplot.js:5392
/sandbox/adsk/2.4j/Web/src/viewerfiles/quickplot.js:6327-6405
/trunk/MgDev/Web/src/viewerfiles/quickplot.js:6250-6326
+ /sandbox/adsk/2.2gp/Web/src/viewerfiles/quickplot.js:5392
/sandbox/adsk/2.4j/Web/src/viewerfiles/quickplot.js:6327-6474
/trunk/MgDev/Web/src/viewerfiles/quickplot.js:6250-6326
Modified: trunk/MgDev/Web/src/viewerfiles/quickplotpreviewinner.templ
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/quickplotpreviewinner.templ 2012-02-02 02:39:29 UTC (rev 6474)
+++ trunk/MgDev/Web/src/viewerfiles/quickplotpreviewinner.templ 2012-02-02 02:45:38 UTC (rev 6475)
@@ -81,7 +81,7 @@
<td><table width="100%%" border="0" cellspacing="0" cellpadding="0">
<tr>
<!-- Legal notice. Just replace it with the necessary statement -->
- <td style="width:100%%" class="LegalNotice">The materials available at this web site are for informational purposes only and do not constitute a legal document.</td>
+ <td style="width:100%%" id="legalNotice" class="LegalNotice">The materials available at this web site are for informational purposes only and do not constitute a legal document.</td>
<td style="white-space:nowrap"><input type="button" id="PrintButton" class="Button" onClick="printIt()" value="__#QUICKPLOT_PRINT#__" /><input type="button" id="CancelButton" class="Button" onClick="cancelPreview()" value="__#QUICKPLOT_CANCEL#__" />
</td>
</tr>
More information about the mapguide-commits
mailing list