[mapguide-commits] r6531 - sandbox/adsk/2.3r/Web/src/viewerfiles

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Feb 28 02:48:08 EST 2012


Author: liuar
Date: 2012-02-27 23:48:08 -0800 (Mon, 27 Feb 2012)
New Revision: 6531

Modified:
   sandbox/adsk/2.3r/Web/src/viewerfiles/quickplot.js
   sandbox/adsk/2.3r/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: sandbox/adsk/2.3r/Web/src/viewerfiles/quickplot.js
===================================================================
--- sandbox/adsk/2.3r/Web/src/viewerfiles/quickplot.js	2012-02-20 09:22:40 UTC (rev 6530)
+++ sandbox/adsk/2.3r/Web/src/viewerfiles/quickplot.js	2012-02-28 07:48:08 UTC (rev 6531)
@@ -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];
@@ -859,14 +854,16 @@
                   "&box=" + this.captureInfo.params1 +
                   "&normalized_box=" + this.captureInfo.params2 + 
                   "&scale_denominator=" + this.captureInfo.scaleDenominator + 
-                  "&rotation=" + this.captureInfo.rotation; 
+                  "&rotation=" + this.captureInfo.rotation + 
+                  "&timestamp=" + (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 
@@ -908,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;
@@ -944,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: sandbox/adsk/2.3r/Web/src/viewerfiles/quickplot.js
___________________________________________________________________
Added: svn:mergeinfo
   + /Web/src/viewerfiles/quickplot.js:5504
/sandbox/adsk/2.4j/Web/src/viewerfiles/quickplot.js:6405,6474
/trunk/MgDev/Web/src/viewerfiles/quickplot.js:5504,5539,5561-5562,6010

Modified: sandbox/adsk/2.3r/Web/src/viewerfiles/quickplotpreviewinner.templ
===================================================================
--- sandbox/adsk/2.3r/Web/src/viewerfiles/quickplotpreviewinner.templ	2012-02-20 09:22:40 UTC (rev 6530)
+++ sandbox/adsk/2.3r/Web/src/viewerfiles/quickplotpreviewinner.templ	2012-02-28 07:48:08 UTC (rev 6531)
@@ -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>


Property changes on: sandbox/adsk/2.3r/Web/src/viewerfiles/quickplotpreviewinner.templ
___________________________________________________________________
Added: svn:mergeinfo
   + /Web/src/viewerfiles/quickplotpreviewinner.templ:5504
/sandbox/adsk/2.4j/Web/src/viewerfiles/quickplotpreviewinner.templ:6474
/trunk/MgDev/Web/src/viewerfiles/quickplotpreviewinner.templ:5504,5539,5561-5562,6010



More information about the mapguide-commits mailing list