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

📄 shape.js

📁 这是一个ajax的例子大家好好的看看就是一个鱼眼的效果
💻 JS
📖 第 1 页 / 共 2 页
字号:
if(!dojo._hasResource["dojox.gfx.shape"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dojox.gfx.shape"] = true;dojo.provide("dojox.gfx.shape");dojo.require("dojox.gfx._base");dojo.declare("dojox.gfx.Shape", null, {	// summary: a Shape object, which knows how to apply 	// graphical attributes and transformations		constructor: function(){		// rawNode: Node: underlying node		this.rawNode = null;				// shape: Object: an abstract shape object		//	(see dojox.gfx.defaultPath,		//	dojox.gfx.defaultPolyline,		//	dojox.gfx.defaultRect,		//	dojox.gfx.defaultEllipse,		//	dojox.gfx.defaultCircle,		//	dojox.gfx.defaultLine,		//	or dojox.gfx.defaultImage)		this.shape = null;				// matrix: dojox.gfx.Matrix2D: a transformation matrix		this.matrix = null;				// fillStyle: Object: a fill object 		//	(see dojox.gfx.defaultLinearGradient, 		//	dojox.gfx.defaultRadialGradient, 		//	dojox.gfx.defaultPattern, 		//	or dojo.Color)		this.fillStyle = null;				// strokeStyle: Object: a stroke object 		//	(see dojox.gfx.defaultStroke) 		this.strokeStyle = null;				// bbox: dojox.gfx.Rectangle: a bounding box of this shape		//	(see dojox.gfx.defaultRect)		this.bbox = null;				// virtual group structure				// parent: Object: a parent or null		//	(see dojox.gfx.Surface,		//	dojox.gfx.shape.VirtualGroup,		//	or dojox.gfx.Group)		this.parent = null;				// parentMatrix: dojox.gfx.Matrix2D		//	a transformation matrix inherited from the parent		this.parentMatrix = null;	},		// trivial getters		getNode: function(){		// summary: returns the current DOM Node or null		return this.rawNode; // Node	},	getShape: function(){		// summary: returns the current shape object or null		//	(see dojox.gfx.defaultPath,		//	dojox.gfx.defaultPolyline,		//	dojox.gfx.defaultRect,		//	dojox.gfx.defaultEllipse,		//	dojox.gfx.defaultCircle,		//	dojox.gfx.defaultLine,		//	or dojox.gfx.defaultImage)		return this.shape; // Object	},	getTransform: function(){		// summary: returns the current transformation matrix or null		return this.matrix;	// dojox.gfx.Matrix2D	},	getFill: function(){		// summary: returns the current fill object or null		//	(see dojox.gfx.defaultLinearGradient, 		//	dojox.gfx.defaultRadialGradient, 		//	dojox.gfx.defaultPattern, 		//	or dojo.Color)		return this.fillStyle;	// Object	},	getStroke: function(){		// summary: returns the current stroke object or null		//	(see dojox.gfx.defaultStroke) 		return this.strokeStyle;	// Object	},	getParent: function(){		// summary: returns the parent or null		//	(see dojox.gfx.Surface,		//	dojox.gfx.shape.VirtualGroup,		//	or dojox.gfx.Group)		return this.parent;	// Object	},	getBoundingBox: function(){		// summary: returns the bounding box or null		//	(see dojox.gfx.defaultRect)		return this.bbox;	// dojox.gfx.Rectangle	},	getTransformedBoundingBox: function(){		// summary: returns an array of four points or null		//	four points represent four corners of the untransformed bounding box		var b = this.getBoundingBox();		if(!b){			return null;	// null		}		var m = this._getRealMatrix();		var r = [];		var g = dojox.gfx.matrix;		r.push(g.multiplyPoint(m, b.x, b.y));		r.push(g.multiplyPoint(m, b.x + b.width, b.y));		r.push(g.multiplyPoint(m, b.x + b.width, b.y + b.height));		r.push(g.multiplyPoint(m, b.x, b.y + b.height));		return r;	// Array	},	getEventSource: function(){		// summary: returns a Node, which is used as 		//	a source of events for this shape		// COULD BE RE-IMPLEMENTED BY THE RENDERER!		return this.rawNode;	// Node	},		// empty settings		setShape: function(shape){		// summary: sets a shape object		//	(the default implementation simply ignores it)		// shape: Object: a shape object		//	(see dojox.gfx.defaultPath,		//	dojox.gfx.defaultPolyline,		//	dojox.gfx.defaultRect,		//	dojox.gfx.defaultEllipse,		//	dojox.gfx.defaultCircle,		//	dojox.gfx.defaultLine,		//	or dojox.gfx.defaultImage)		// COULD BE RE-IMPLEMENTED BY THE RENDERER!		this.shape = dojox.gfx.makeParameters(this.shape, shape);		this.bbox = null;		return this;	// self	},	setFill: function(fill){		// summary: sets a fill object		//	(the default implementation simply ignores it)		// fill: Object: a fill object		//	(see dojox.gfx.defaultLinearGradient, 		//	dojox.gfx.defaultRadialGradient, 		//	dojox.gfx.defaultPattern, 		//	or dojo.Color)		// COULD BE RE-IMPLEMENTED BY THE RENDERER!		if(!fill){			// don't fill			this.fillStyle = null;			return this;	// self		}		var f = null;		if(typeof(fill) == "object" && "type" in fill){			// gradient or pattern			switch(fill.type){				case "linear":					f = dojox.gfx.makeParameters(dojox.gfx.defaultLinearGradient, fill);					break;				case "radial":					f = dojox.gfx.makeParameters(dojox.gfx.defaultRadialGradient, fill);					break;				case "pattern":					f = dojox.gfx.makeParameters(dojox.gfx.defaultPattern, fill);					break;			}		}else{			// color object			f = dojox.gfx.normalizeColor(fill);		}		this.fillStyle = f;		return this;	// self	},	setStroke: function(stroke){		// summary: sets a stroke object		//	(the default implementation simply ignores it)		// stroke: Object: a stroke object		//	(see dojox.gfx.defaultStroke) 		// COULD BE RE-IMPLEMENTED BY THE RENDERER!		if(!stroke){			// don't stroke			this.strokeStyle = null;			return this;	// self		}		// normalize the stroke		if(typeof stroke == "string"){			stroke = {color: stroke};		}		var s = this.strokeStyle = dojox.gfx.makeParameters(dojox.gfx.defaultStroke, stroke);		s.color = dojox.gfx.normalizeColor(s.color);		return this;	// self	},	setTransform: function(matrix){		// summary: sets a transformation matrix		// matrix: dojox.gfx.Matrix2D: a matrix or a matrix-like object		//	(see an argument of dojox.gfx.Matrix2D 		//	constructor for a list of acceptable arguments)		// COULD BE RE-IMPLEMENTED BY THE RENDERER!		this.matrix = dojox.gfx.matrix.clone(matrix ? dojox.gfx.matrix.normalize(matrix) : dojox.gfx.matrix.identity);		return this._applyTransform();	// self	},		_applyTransform: function(){		// summary: physically sets a matrix		// COULD BE RE-IMPLEMENTED BY THE RENDERER!		return this;	// self	},		// z-index		moveToFront: function(){		// summary: moves a shape to front of its parent's list of shapes		var p = this.getParent();		if(p){			p._moveChildToFront(this);			this._moveToFront();	// execute renderer-specific action		}		return this;	// self	},	moveToBack: function(){		// summary: moves a shape to back of its parent's list of shapes		var p = this.getParent();		if(p){			p._moveChildToBack(this);			this._moveToBack();	// execute renderer-specific action		}		return this;	},	_moveToFront: function(){		// summary: renderer-specific hook, see dojox.gfx.shape.Shape.moveToFront()		// COULD BE RE-IMPLEMENTED BY THE RENDERER!	},	_moveToBack: function(){		// summary: renderer-specific hook, see dojox.gfx.shape.Shape.moveToFront()		// COULD BE RE-IMPLEMENTED BY THE RENDERER!	},	// apply left & right transformation		applyRightTransform: function(matrix){		// summary: multiplies the existing matrix with an argument on right side		//	(this.matrix * matrix)		// matrix: dojox.gfx.Matrix2D: a matrix or a matrix-like object		//	(see an argument of dojox.gfx.Matrix2D 		//	constructor for a list of acceptable arguments)		return matrix ? this.setTransform([this.matrix, matrix]) : this;	// self	},	applyLeftTransform: function(matrix){		// summary: multiplies the existing matrix with an argument on left side		//	(matrix * this.matrix)		// matrix: dojox.gfx.Matrix2D: a matrix or a matrix-like object		//	(see an argument of dojox.gfx.Matrix2D 		//	constructor for a list of acceptable arguments)		return matrix ? this.setTransform([matrix, this.matrix]) : this;	// self	},	applyTransform: function(matrix){		// summary: a shortcut for dojox.gfx.Shape.applyRightTransform		// matrix: dojox.gfx.Matrix2D: a matrix or a matrix-like object		//	(see an argument of dojox.gfx.Matrix2D 		//	constructor for a list of acceptable arguments)		return matrix ? this.setTransform([this.matrix, matrix]) : this;	// self	},		// virtual group methods		removeShape: function(silently){		// summary: removes the shape from its parent's list of shapes		// silently: Boolean?: if true, do not redraw a picture yet		if(this.parent){			this.parent.remove(this, silently);		}		return this;	// self	},	_setParent: function(parent, matrix){		// summary: sets a parent		// parent: Object: a parent or null		//	(see dojox.gfx.Surface,		//	dojox.gfx.shape.VirtualGroup,		//	or dojox.gfx.Group)		// matrix: dojox.gfx.Matrix2D:		//	a 2D matrix or a matrix-like object		this.parent = parent;		return this._updateParentMatrix(matrix);	// self	},	_updateParentMatrix: function(matrix){		// summary: updates the parent matrix with new matrix		// matrix: dojox.gfx.Matrix2D:		//	a 2D matrix or a matrix-like object		this.parentMatrix = matrix ? dojox.gfx.matrix.clone(matrix) : null;		return this._applyTransform();	// self	},	_getRealMatrix: function(){		// summary: returns the cumulative ("real") transformation matrix		//	by combining the shape's matrix with its parent's matrix		var m = this.matrix;		var p = this.parent;		while(p){			if(p.matrix){				m = dojox.gfx.matrix.multiply(p.matrix, m);			}			p = p.parent;		}		return m;	// dojox.gfx.Matrix2D	}});dojox.gfx.shape._eventsProcessing = {	connect: function(name, object, method){		// summary: connects a handler to an event on this shape		// COULD BE RE-IMPLEMENTED BY THE RENDERER!		return arguments.length > 2 ?	// Object			dojo.connect(this.getEventSource(), name, object, method) :			dojo.connect(this.getEventSource(), name, object);	},	disconnect: function(token){		// summary: connects a handler by token from an event on this shape		// COULD BE RE-IMPLEMENTED BY THE RENDERER!		dojo.disconnect(token);	}};dojo.extend(dojox.gfx.Shape, dojox.gfx.shape._eventsProcessing);dojox.gfx.shape.Container = {

⌨️ 快捷键说明

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