⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vml.js

📁 用最近的dojo1.2.1制作前端的ajax购书网站
💻 JS
📖 第 1 页 / 共 2 页
字号:
/*	Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved.	Available via Academic Free License >= 2.1 OR the modified BSD license.	see: http://dojotoolkit.org/license for details*/if(!dojo._hasResource["dojox.gfx.vml"]){dojo._hasResource["dojox.gfx.vml"]=true;dojo.provide("dojox.gfx.vml");dojo.require("dojox.gfx._base");dojo.require("dojox.gfx.shape");dojo.require("dojox.gfx.path");dojo.require("dojox.gfx.arc");dojox.gfx.vml.xmlns="urn:schemas-microsoft-com:vml";dojox.gfx.vml.text_alignment={start:"left",middle:"center",end:"right"};dojox.gfx.vml._parseFloat=function(_1){return _1.match(/^\d+f$/i)?parseInt(_1)/65536:parseFloat(_1);};dojox.gfx.vml._bool={"t":1,"true":1};dojo.extend(dojox.gfx.Shape,{setFill:function(_2){if(!_2){this.fillStyle=null;this.rawNode.filled="f";return this;}if(typeof _2=="object"&&"type" in _2){var i,f,fo,a,s;switch(_2.type){case "linear":var _8=this._getRealMatrix(),m=dojox.gfx.matrix;s=[];f=dojox.gfx.makeParameters(dojox.gfx.defaultLinearGradient,_2);a=f.colors;this.fillStyle=f;dojo.forEach(a,function(v,i,a){a[i].color=dojox.gfx.normalizeColor(v.color);});if(a[0].offset>0){s.push("0 "+a[0].color.toHex());}for(i=0;i<a.length;++i){s.push(a[i].offset.toFixed(8)+" "+a[i].color.toHex());}i=a.length-1;if(a[i].offset<1){s.push("1 "+a[i].color.toHex());}fo=this.rawNode.fill;fo.colors.value=s.join(";");fo.method="sigma";fo.type="gradient";var _d=_8?m.multiplyPoint(_8,f.x1,f.y1):{x:f.x1,y:f.y1},_e=_8?m.multiplyPoint(_8,f.x2,f.y2):{x:f.x2,y:f.y2};fo.angle=(m._radToDeg(Math.atan2(_e.x-_d.x,_e.y-_d.y))+180)%360;fo.on=true;break;case "radial":f=dojox.gfx.makeParameters(dojox.gfx.defaultRadialGradient,_2);this.fillStyle=f;var l=parseFloat(this.rawNode.style.left),t=parseFloat(this.rawNode.style.top),w=parseFloat(this.rawNode.style.width),h=parseFloat(this.rawNode.style.height),c=isNaN(w)?1:2*f.r/w;a=[];if(f.colors[0].offset>0){a.push({offset:1,color:dojox.gfx.normalizeColor(f.colors[0].color)});}dojo.forEach(f.colors,function(v,i){a.push({offset:1-v.offset*c,color:dojox.gfx.normalizeColor(v.color)});});i=a.length-1;while(i>=0&&a[i].offset<0){--i;}if(i<a.length-1){var q=a[i],p=a[i+1];p.color=dojo.blendColors(q.color,p.color,q.offset/(q.offset-p.offset));p.offset=0;while(a.length-i>2){a.pop();}}i=a.length-1,s=[];if(a[i].offset>0){s.push("0 "+a[i].color.toHex());}for(;i>=0;--i){s.push(a[i].offset.toFixed(8)+" "+a[i].color.toHex());}fo=this.rawNode.fill;fo.colors.value=s.join(";");fo.method="sigma";fo.type="gradientradial";if(isNaN(w)||isNaN(h)||isNaN(l)||isNaN(t)){fo.focusposition="0.5 0.5";}else{fo.focusposition=((f.cx-l)/w).toFixed(8)+" "+((f.cy-t)/h).toFixed(8);}fo.focussize="0 0";fo.on=true;break;case "pattern":f=dojox.gfx.makeParameters(dojox.gfx.defaultPattern,_2);this.fillStyle=f;fo=this.rawNode.fill;fo.type="tile";fo.src=f.src;if(f.width&&f.height){fo.size.x=dojox.gfx.px2pt(f.width);fo.size.y=dojox.gfx.px2pt(f.height);}fo.alignShape="f";fo.position.x=0;fo.position.y=0;fo.origin.x=f.width?f.x/f.width:0;fo.origin.y=f.height?f.y/f.height:0;fo.on=true;break;}this.rawNode.fill.opacity=1;return this;}this.fillStyle=dojox.gfx.normalizeColor(_2);this.rawNode.fill.method="any";this.rawNode.fill.type="solid";this.rawNode.fillcolor=this.fillStyle.toHex();this.rawNode.fill.opacity=this.fillStyle.a;this.rawNode.filled=true;return this;},setStroke:function(_18){if(!_18){this.strokeStyle=null;this.rawNode.stroked="f";return this;}if(typeof _18=="string"||dojo.isArray(_18)||_18 instanceof dojo.Color){_18={color:_18};}var s=this.strokeStyle=dojox.gfx.makeParameters(dojox.gfx.defaultStroke,_18);s.color=dojox.gfx.normalizeColor(s.color);var rn=this.rawNode;rn.stroked=true;rn.strokecolor=s.color.toCss();rn.strokeweight=s.width+"px";if(rn.stroke){rn.stroke.opacity=s.color.a;rn.stroke.endcap=this._translate(this._capMap,s.cap);if(typeof s.join=="number"){rn.stroke.joinstyle="miter";rn.stroke.miterlimit=s.join;}else{rn.stroke.joinstyle=s.join;}rn.stroke.dashstyle=s.style=="none"?"Solid":s.style;}return this;},_capMap:{butt:"flat"},_capMapReversed:{flat:"butt"},_translate:function(_1b,_1c){return (_1c in _1b)?_1b[_1c]:_1c;},_applyTransform:function(){if(this.fillStyle&&this.fillStyle.type=="linear"){this.setFill(this.fillStyle);}var _1d=this._getRealMatrix();if(!_1d){return this;}var _1e=this.rawNode.skew;if(typeof _1e=="undefined"){for(var i=0;i<this.rawNode.childNodes.length;++i){if(this.rawNode.childNodes[i].tagName=="skew"){_1e=this.rawNode.childNodes[i];break;}}}if(_1e){_1e.on="f";var mt=_1d.xx.toFixed(8)+" "+_1d.xy.toFixed(8)+" "+_1d.yx.toFixed(8)+" "+_1d.yy.toFixed(8)+" 0 0",_21=Math.floor(_1d.dx).toFixed()+"px "+Math.floor(_1d.dy).toFixed()+"px",s=this.rawNode.style,l=parseFloat(s.left),t=parseFloat(s.top),w=parseFloat(s.width),h=parseFloat(s.height);if(isNaN(l)){l=0;}if(isNaN(t)){t=0;}if(isNaN(w)){w=1;}if(isNaN(h)){h=1;}var _27=(-l/w-0.5).toFixed(8)+" "+(-t/h-0.5).toFixed(8);_1e.matrix=mt;_1e.origin=_27;_1e.offset=_21;_1e.on=true;}return this;},setRawNode:function(_28){_28.stroked="f";_28.filled="f";this.rawNode=_28;},_moveToFront:function(){this.rawNode.parentNode.appendChild(this.rawNode);return this;},_moveToBack:function(){var r=this.rawNode,p=r.parentNode,n=p.firstChild;p.insertBefore(r,n);if(n.tagName=="rect"){n.swapNode(r);}return this;},_getRealMatrix:function(){return this.parentMatrix?new dojox.gfx.Matrix2D([this.parentMatrix,this.matrix]):this.matrix;}});dojo.declare("dojox.gfx.Group",dojox.gfx.Shape,{constructor:function(){dojox.gfx.vml.Container._init.call(this);},_applyTransform:function(){var _2c=this._getRealMatrix();for(var i=0;i<this.children.length;++i){this.children[i]._updateParentMatrix(_2c);}return this;}});dojox.gfx.Group.nodeType="group";dojo.declare("dojox.gfx.Rect",dojox.gfx.shape.Rect,{setShape:function(_2e){var _2f=this.shape=dojox.gfx.makeParameters(this.shape,_2e);this.bbox=null;var _30=this.rawNode.style;_30.left=_2f.x.toFixed();_30.top=_2f.y.toFixed();_30.width=(typeof _2f.width=="string"&&_2f.width.indexOf("%")>=0)?_2f.width:_2f.width.toFixed();_30.height=(typeof _2f.width=="string"&&_2f.height.indexOf("%")>=0)?_2f.height:_2f.height.toFixed();var r=Math.min(1,(_2f.r/Math.min(parseFloat(_2f.width),parseFloat(_2f.height)))).toFixed(8);var _32=this.rawNode.parentNode,_33=null;if(_32){if(_32.lastChild!=this.rawNode){for(var i=0;i<_32.childNodes.length;++i){if(_32.childNodes[i]==this.rawNode){_33=_32.childNodes[i+1];break;}}}_32.removeChild(this.rawNode);}this.rawNode.arcsize=r;if(_32){if(_33){_32.insertBefore(this.rawNode,_33);}else{_32.appendChild(this.rawNode);}}return this.setTransform(this.matrix).setFill(this.fillStyle).setStroke(this.strokeStyle);}});dojox.gfx.Rect.nodeType="roundrect";dojo.declare("dojox.gfx.Ellipse",dojox.gfx.shape.Ellipse,{setShape:function(_35){var _36=this.shape=dojox.gfx.makeParameters(this.shape,_35);this.bbox=null;var _37=this.rawNode.style;_37.left=(_36.cx-_36.rx).toFixed();_37.top=(_36.cy-_36.ry).toFixed();_37.width=(_36.rx*2).toFixed();_37.height=(_36.ry*2).toFixed();return this.setTransform(this.matrix);}});dojox.gfx.Ellipse.nodeType="oval";dojo.declare("dojox.gfx.Circle",dojox.gfx.shape.Circle,{setShape:function(_38){var _39=this.shape=dojox.gfx.makeParameters(this.shape,_38);this.bbox=null;var _3a=this.rawNode.style;_3a.left=(_39.cx-_39.r).toFixed();_3a.top=(_39.cy-_39.r).toFixed();_3a.width=(_39.r*2).toFixed();_3a.height=(_39.r*2).toFixed();return this;}});dojox.gfx.Circle.nodeType="oval";dojo.declare("dojox.gfx.Line",dojox.gfx.shape.Line,{constructor:function(_3b){if(_3b){_3b.setAttribute("dojoGfxType","line");}},setShape:function(_3c){var _3d=this.shape=dojox.gfx.makeParameters(this.shape,_3c);this.bbox=null;this.rawNode.path.v="m"+_3d.x1.toFixed()+" "+_3d.y1.toFixed()+"l"+_3d.x2.toFixed()+" "+_3d.y2.toFixed()+"e";return this.setTransform(this.matrix);}});dojox.gfx.Line.nodeType="shape";dojo.declare("dojox.gfx.Polyline",dojox.gfx.shape.Polyline,{constructor:function(_3e){if(_3e){_3e.setAttribute("dojoGfxType","polyline");}},setShape:function(_3f,_40){if(_3f&&_3f instanceof Array){this.shape=dojox.gfx.makeParameters(this.shape,{points:_3f});if(_40&&this.shape.points.length){this.shape.points.push(this.shape.points[0]);}}else{this.shape=dojox.gfx.makeParameters(this.shape,_3f);}this.bbox=null;var _41=[],p=this.shape.points;if(p.length>0){_41.push("m");var k=1;if(typeof p[0]=="number"){_41.push(p[0].toFixed());_41.push(p[1].toFixed());k=2;}else{_41.push(p[0].x.toFixed());_41.push(p[0].y.toFixed());}if(p.length>k){_41.push("l");for(var i=k;i<p.length;++i){if(typeof p[i]=="number"){_41.push(p[i].toFixed());}else{_41.push(p[i].x.toFixed());_41.push(p[i].y.toFixed());}}}}_41.push("e");this.rawNode.path.v=_41.join(" ");return this.setTransform(this.matrix);}});dojox.gfx.Polyline.nodeType="shape";dojo.declare("dojox.gfx.Image",dojox.gfx.shape.Image,{constructor:function(_45){if(_45){_45.setAttribute("dojoGfxType","image");}},getEventSource:function(){return this.rawNode?this.rawNode.firstChild:null;},setShape:function(_46){var _47=this.shape=dojox.gfx.makeParameters(this.shape,_46);this.bbox=null;this.rawNode.firstChild.src=_47.src;return this.setTransform(this.matrix);},_setDimensions:function(s,w,h){if(w||h){s.width=w+"px";s.height=h+"px";}},_resetImage:function(){var s=this.rawNode.firstChild.style,_4c=this.shape;s.left="0px";s.top="0px";this._setDimensions(s,_4c.width,_4c.height);},_applyTransform:function(){var _4d=this._getRealMatrix(),img=this.rawNode.firstChild,s=img.style,_50=this.shape;if(_4d){_4d=dojox.gfx.matrix.multiply(_4d,{dx:_50.x,dy:_50.y});}else{_4d=dojox.gfx.matrix.normalize({dx:_50.x,dy:_50.y});}if(_4d.xy==0&&_4d.yx==0&&_4d.xx>0&&_4d.yy>0){this.rawNode.style.filter="";s.left=Math.floor(_4d.dx)+"px";s.top=Math.floor(_4d.dy)+"px";this._setDimensions(s,Math.floor(_4d.xx*_50.width),Math.floor(_4d.yy*_50.height));}else{this._resetImage();var f=this.rawNode.filters["DXImageTransform.Microsoft.Matrix"];if(f){f.M11=_4d.xx;f.M12=_4d.xy;f.M21=_4d.yx;f.M22=_4d.yy;f.Dx=_4d.dx;f.Dy=_4d.dy;}else{this.rawNode.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+_4d.xx+", M12="+_4d.xy+", M21="+_4d.yx+", M22="+_4d.yy+", Dx="+_4d.dx+", Dy="+_4d.dy+")";}}return this;}});dojox.gfx.Image.nodeType="div";dojo.declare("dojox.gfx.Text",dojox.gfx.shape.Text,{constructor:function(_52){if(_52){_52.setAttribute("dojoGfxType","text");}this.fontStyle=null;},_alignment:{start:"left",middle:"center",end:"right"},setShape:function(_53){this.shape=dojox.gfx.makeParameters(this.shape,_53);this.bbox=null;var r=this.rawNode,s=this.shape,x=s.x,y=s.y.toFixed();switch(s.align){case "middle":x-=5;break;case "end":x-=10;break;}this.rawNode.path.v="m"+x.toFixed()+","+y+"l"+(x+10).toFixed()+","+y+"e";var p=null,t=null,c=r.childNodes;for(var i=0;i<c.length;++i){var tag=c[i].tagName;if(tag=="path"){p=c[i];if(t){break;}}else{if(tag=="textpath"){t=c[i];if(p){break;}}}}if(!p){p=this.rawNode.ownerDocument.createElement("v:path");r.appendChild(p);}if(!t){t=this.rawNode.ownerDocument.createElement("v:textpath");r.appendChild(t);}p.textPathOk=true;t.on=true;var a=dojox.gfx.vml.text_alignment[s.align];t.style["v-text-align"]=a?a:"left";t.style["text-decoration"]=s.decoration;t.style["v-rotate-letters"]=s.rotated;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -