[fusion-commits] r2530 - sandbox/adsk/2.3r/widgets/QuickPlot
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Tue Feb 28 02:49:14 EST 2012
Author: liuar
Date: 2012-02-27 23:49:14 -0800 (Mon, 27 Feb 2012)
New Revision: 2530
Modified:
sandbox/adsk/2.3r/widgets/QuickPlot/PreviewDialog.js
sandbox/adsk/2.3r/widgets/QuickPlot/QuickPlotPreviewInner.templ
Log:
Submit on behalf of Mars Wu
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: sandbox/adsk/2.3r/widgets/QuickPlot/PreviewDialog.js
===================================================================
--- sandbox/adsk/2.3r/widgets/QuickPlot/PreviewDialog.js 2012-02-02 02:51:14 UTC (rev 2529)
+++ sandbox/adsk/2.3r/widgets/QuickPlot/PreviewDialog.js 2012-02-28 07:49:14 UTC (rev 2530)
@@ -49,11 +49,11 @@
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>' +
+ ' <tr>' +
+ ' <td>' +
+ ' <iframe id="PreviewFrame" scrolling="no" frameborder="0" style="border: 0px; width: 400px; height: 300px;" src="about:blank"></iframe>' +
+ ' </td>' +
+ ' </tr>' +
'</table>'
});
@@ -130,22 +130,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"));
-
- 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;
+ // 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();
+ }
+
// Get the styles for the print picture
var rules = this.innerDoc.styleSheets[1].cssRules || this.innerDoc.styleSheets[1].rules;
this.previewStyle = rules[0];
@@ -166,14 +161,15 @@
"&box=" + this.captureInfo.params1 +
"&normalized_box=" + this.captureInfo.params2 +
"&scale_denominator=" + this.captureInfo.scaleDenominator +
- "&rotation=" + this.captureInfo.rotation;
+ "&rotation=" + this.captureInfo.rotation +
+ "×tamp=" + (new Date()).getTime();
this.printPicture = $(this.innerDoc.getElementById("PrintPicture"));
- this.printPicture.src = src;
// Listen to print picture onload vent
this.printPicture.addEvent("load", this.printPictureLoaded.bind(this));
this.printPicture.addEvent("error", this.printPictureLoadError.bind(this));
+ this.printPicture.src = src;
var innerBox = this.previewContainer.getMarginBoxSize();
// Resize the frame according to the inner container's
@@ -210,6 +206,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;
@@ -246,15 +267,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: sandbox/adsk/2.3r/widgets/QuickPlot/PreviewDialog.js
___________________________________________________________________
Added: svn:mergeinfo
+ /sandbox/adsk/2.4j/widgets/QuickPlot/PreviewDialog.js:2508,2528
/trunk/widgets/QuickPlot/PreviewDialog.js:2192-2233
Modified: sandbox/adsk/2.3r/widgets/QuickPlot/QuickPlotPreviewInner.templ
===================================================================
--- sandbox/adsk/2.3r/widgets/QuickPlot/QuickPlotPreviewInner.templ 2012-02-02 02:51:14 UTC (rev 2529)
+++ sandbox/adsk/2.3r/widgets/QuickPlot/QuickPlotPreviewInner.templ 2012-02-28 07:49:14 UTC (rev 2530)
@@ -74,7 +74,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%%" class="LegalNotice" id="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 fusion-commits
mailing list