[fusion-commits] r1530 - branches/fusion-1.1/lib/excanvas

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Sep 12 15:26:25 EDT 2008


Author: madair
Date: 2008-09-12 15:26:25 -0400 (Fri, 12 Sep 2008)
New Revision: 1530

Modified:
   branches/fusion-1.1/lib/excanvas/excanvas-compressed.js
   branches/fusion-1.1/lib/excanvas/excanvas.js
Log:
closes #125: better detection of Safari to prevent loading of excanvas

Modified: branches/fusion-1.1/lib/excanvas/excanvas-compressed.js
===================================================================
--- branches/fusion-1.1/lib/excanvas/excanvas-compressed.js	2008-09-12 19:25:59 UTC (rev 1529)
+++ branches/fusion-1.1/lib/excanvas/excanvas-compressed.js	2008-09-12 19:26:25 UTC (rev 1530)
@@ -1,4 +1,4 @@
-if(!window.CanvasRenderingContext2D){(function(){var I=Math,i=I.round,L=I.sin,M=I.cos,m=10,A=m/2,Q={init:function(a){var b=a||document;if(/MSIE/.test(navigator.userAgent)&&!window.opera){var c=this;b.attachEvent("onreadystatechange",function(){c.r(b)})}},r:function(a){if(a.readyState=="complete"){if(!a.namespaces["s"]){a.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml")}var b=a.createStyleSheet();b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}";
+if(!window.CanvasRenderingContext2D&&!/WebKit/.test(navigator.userAgent)){(function(){var I=Math,i=I.round,L=I.sin,M=I.cos,m=10,A=m/2,Q={init:function(a){var b=a||document;if(/MSIE/.test(navigator.userAgent)&&!window.opera){var c=this;b.attachEvent("onreadystatechange",function(){c.r(b)})}},r:function(a){if(a.readyState=="complete"){if(!a.namespaces["s"]){a.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml")}var b=a.createStyleSheet();b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}";
 var c=a.getElementsByTagName("canvas");for(var d=0;d<c.length;d++){if(!c[d].getContext){this.initElement(c[d])}}}},q:function(a){var b=a.outerHTML,c=a.ownerDocument.createElement(b);if(b.slice(-2)!="/>"){var d="/"+a.tagName,e;while((e=a.nextSibling)&&e.tagName!=d){e.removeNode()}if(e){e.removeNode()}}a.parentNode.replaceChild(c,a);return c},initElement:function(a){a=this.q(a);a.getContext=function(){if(this.l){return this.l}return this.l=new K(this)};a.attachEvent("onpropertychange",V);a.attachEvent("onresize",
 W);var b=a.attributes;if(b.width&&b.width.specified){a.style.width=b.width.nodeValue+"px"}else{a.width=a.clientWidth}if(b.height&&b.height.specified){a.style.height=b.height.nodeValue+"px"}else{a.height=a.clientHeight}return a}};function V(a){var b=a.srcElement;switch(a.propertyName){case "width":b.style.width=b.attributes.width.nodeValue+"px";b.getContext().clearRect();break;case "height":b.style.height=b.attributes.height.nodeValue+"px";b.getContext().clearRect();break}}function W(a){var b=a.srcElement;
 if(b.firstChild){b.firstChild.style.width=b.clientWidth+"px";b.firstChild.style.height=b.clientHeight+"px"}}Q.init();var R=[];for(var E=0;E<16;E++){for(var F=0;F<16;F++){R[E*16+F]=E.toString(16)+F.toString(16)}}function J(){return[[1,0,0],[0,1,0],[0,0,1]]}function G(a,b){var c=J();for(var d=0;d<3;d++){for(var e=0;e<3;e++){var g=0;for(var h=0;h<3;h++){g+=a[d][h]*b[h][e]}c[d][e]=g}}return c}function N(a,b){b.fillStyle=a.fillStyle;b.lineCap=a.lineCap;b.lineJoin=a.lineJoin;b.lineWidth=a.lineWidth;b.miterLimit=

Modified: branches/fusion-1.1/lib/excanvas/excanvas.js
===================================================================
--- branches/fusion-1.1/lib/excanvas/excanvas.js	2008-09-12 19:25:59 UTC (rev 1529)
+++ branches/fusion-1.1/lib/excanvas/excanvas.js	2008-09-12 19:26:25 UTC (rev 1530)
@@ -31,7 +31,7 @@
 // * Optimize. There is always room for speed improvements.
 
 // only add this code if we do not already have a canvas implementation
-if (!window.CanvasRenderingContext2D) {
+if (!window.CanvasRenderingContext2D && !/WebKit/.test(navigator.userAgent)) {
 
 (function () {
 
@@ -501,9 +501,9 @@
 
       vmlStr.push("padding:0 ", mr(max.x / Z), "px ", mr(max.y / Z),
                   "px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",
-                  filter.join(""), ", sizingmethod='clip');");
+                  filter.join(""), ", sizingmethod='clip');")
     } else {
-      vmlStr.push("top:", mr(d.y / Z), "px;left:", mr(d.x / Z), "px;");
+      vmlStr.push("top:", mr(d.y / Z), "px;left:", mr(d.x / Z), "px;")
     }
 
     vmlStr.push(' ">' ,
@@ -681,7 +681,7 @@
 
   contextPrototype.fill = function() {
     this.stroke(true);
-  };
+  }
 
   contextPrototype.closePath = function() {
     this.currentPath_.push({type: "close"});
@@ -694,7 +694,7 @@
     return {
       x: Z * (aX * this.m_[0][0] + aY * this.m_[1][0] + this.m_[2][0]) - Z2,
       y: Z * (aX * this.m_[0][1] + aY * this.m_[1][1] + this.m_[2][1]) - Z2
-    };
+    }
   };
 
   contextPrototype.save = function() {



More information about the fusion-commits mailing list