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

📄 liucheng2.js

📁 2222我而无法说服 去取钱完全 完全
💻 JS
📖 第 1 页 / 共 2 页
字号:
	getStrokeTag:function(){
		return this.getChildTag("stroke",this.config.stroke);
	},
	getPathTag:function(){
		return this.getChildTag("path",this.config.path);
	},
	getTextBoxTag:function(){
		var s="";
		if(this.config.textbox){
			s="<"+this.linkNS(this.namespace,"textbox")+" ";
		}
		for(var p in this.config.textbox){
			s+=this.linkAttr(p,this.config.textbox[p])+" ";
		}
		
		if(this.config.textbox){
			s+=">"+this.config.textbox.text;
			s+="</"+this.linkNS(this.namespace,"textbox")+">";
		}
		//alert(s);
		return s;
		//return this.getTag("textbox",this.config.textbox);
	},
	getTag:function(){
		return ["<"+this.linkNS(this.namespace,this.tag)+" "
					+this.linkAttr("id",this.id)+" "
					+this.linkAttr("style",this.getStyle())+" "
					+">",
				"</"+this.linkNS(this.namespace,this.tag)+">"];
	},
	getChildrenTag:function(){
		return [this.getFillTag(),this.getStrokeTag(),this.getShadowTag(),this.getTextBoxTag(),this.getPathTag()];
	},
	getOuterTag:function(){
		var tags = this.getTag();
		if(tags){
			return tags[0]+this.getChildrenTag().join("")+tags[1];
		}
		return "";
	},
	setLeft:function(left){
		this.left = this.config.style.left = left;
		this.apply({style:{left:left}});
	},
	setTop:function(top) {
		this.top = this.config.style.top  = top;
		this.apply({style:{top:top}});
	},
	setLocation:function(location){
		this.setLeft(location.left);
		this.setTop(location.top);
	},
	getLeft:function(){
		return this.config.style.left||0;
	},
	getTop:function(){
		return this.config.style.top||0;
	},
	getLocation:function(){
		return ({left:this.config.style.left,top:this.config.style.top} || this.defaultLocation);
	},
	getWidth:function(){
		return this.config.style.width||0;
	},
	getHeight:function(){
		return this.config.style.height||0;
	},
	getSize:function(){
		return {width:this.config.style.width,height:this.config.style.height};
	},
	setWidth:function(width){
		this.width = this.config.style.width = width;
		this.apply({style:{width:width}});
	},
	setHeight:function(height){
		this.height = this.config.style.height = height;
		this.apply({style:{height:height}});
	},
	setSize:function(size){
		this.setWidth(size.width);
		this.setHeight(size.height);
	},
	move:function(location){
		this.setLocation(location);
	}, 
	apply:function(attr){
		var ele = this.getElement();
		if(ele&&attr){
			var fn = function(attr,xp){
				for(var p in attr){
					if(typeof attr[p]=="object"){
						fn(attr[p],p);
					} else {
						if(xp){
							ele[xp][p]=attr[p];
						} else{
							ele[p]=attr[p];
						}
					}
				}
			}
			fn(attr);
		}
	},
	clone:function(){
		var sharp = new window[this.constructor];
		sharp.setLocation(this.getLocation());
		sharp.setSize(this.getSize());
		sharp.setStroke(this.config.stroke);
		sharp.setFill(this.config.fill);
		sharp.setShadow(this.config.shadow);
		sharp.setTextBox(this.config.textbox);
		sharp.setStyle(this.config.style);
		return sharp;
	},
	addEvent:function(eventName,handle){
		var ele = this.getElement();
		if(ele){
			ele[eventName] = handle;
		}
	},
	removeEvent:function(eventName){
		var ele = this.getElement();
		if(ele){
			ele[eventName] = null;
		}
	},
	dragBefore:function(){
		event.cancelBubble = true;
		if(this.isDrag){
			this.getElement().setCapture();
		}
		return {downX:event.x,downY:event.y,left:this.getLeft(),top:this.getTop()};
	},
	drag:function(position){
		event.cancelBubble = true;
		if(this.isDrag) {
			this.setLocation(position);
		}
	}, 
	dragEnd:function(){
		event.cancelBubble = true;
		if(this.isDrag) {
			this.getElement().releaseCapture();
			this.removeEvent("onmousemove");
		}
	},
	addDragEvent:function(){
		var ele = this.getElement();
		var self=this;
		if(ele){
				self.addEvent("onmousedown",function(){
					var position = self.dragBefore.call(self);
					self.addEvent("onmousemove",function(){
						self.drag.call(self,{left:event.x-position.downX+position.left,top:event.y-position.downY+position.top});
					});
					self.addEvent("onmouseup",function(){
						self.dragEnd.call(self);					   
					})
			   });
		}  
	},
	hidden:function(){
		this.setLocation({left:0,top:0});
		this.setSize({width:0,height:0});
		
	}
}
gSoft.flow.sharp.prototype.constructor = gSoft.flow.sharp;
window[gSoft.flow.sharp] = gSoft.flow.sharp;

gSoft.flow.line = function(config){
	this.tag = "line";
	this.config = {
		fill:{
			//filled:"true",
			//color:"#000000"
		},
		style:{
			position:"absolute",
			zIndex:gSoft.method.getUniquezIndex(),
			left:0,
			top:0,
			width:1,
			height:1
		},
		stroke:{
			color:"#000000",
			weight:"1",
			dashstyle:"solid",
			startArrow:"",
			endArrow:"Classic"
		}
	};
	this.id = gSoft.method.getUniqueId(config.id);
	this.from = config.from || {x:0,y:0};
	this.to = config.to || {x:0,y:0};
	this.isDrag = config.isDrag || false;
	this.getTag=function(){
		return ["<"+this.linkNS(this.namespace,this.tag)+" "
					+this.linkAttr("id",this.id)+" "
					+this.linkAttr("style",this.getStyle())+" "
					+this.linkAttr("from",this.linkPoint(this.from.x,this.from.y,","))+" "
					+this.linkAttr("to",this.linkPoint(this.to.x,this.to.y,","))+" "
					+">",
				"</"+this.linkNS(this.namespace,this.tag)+">"];
	},
	this.linkPoint=function(name,value){
		return this.link(name,value,",","","");
	};
	this.setFrom=function(from){
		this.from = from;
		this.apply({from:this.linkPoint(this.from.x,this.from.y)});
	};
	this.setTo=function(to){
		this.to = to;
		this.apply({to:this.linkPoint(this.to.x,this.to.y)});
	};
	this.move=function(points){
		if(points&&points.length==2){
			this.setFrom(points[0]);
			this.setTo(points[1]);
		}
	};
	this.hidden=function(){
		this.setFrom({x:0,y:0});
		this.setTo({x:0,y:0});
	};
	this.toString = function(){
		var tag = this.getTag();
		var from = this.linkAttr("from",this.linkPoint(this.from.x,this.from.y,","));
		var to = this.linkAttr("to",this.linkPoint(this.to.x,this.to.y,","));
		return tag[0]+this.getChildrenTag().join("")+tag[1];;
	};
};
gSoft.flow.line.prototype = new gSoft.flow.sharp;
//gSoft.flow.prototype.constructor = gSoft.flow.line;

gSoft.flow.polyLine = function(points,config){
	this.tag = "polyline";
	this.points = points || [{x:0,y:0},{x:0,y:0}];
	this.config = config||{
		fill:{
			//filled:"true",
			//color:"#000000"
		},
		style:{
			position:"absolute",
			zIndex:gSoft.method.getUniquezIndex(),
			left:0,
			top:0,
			width:1,
			height:1
		},
		stroke:{
			color:"#000000",
			weight:"1",
			dashstyle:"solid",
			startArrow:"",
			endArrow:""
		}
	};
	this.getPoints=function(){
		var ps=[];
		for(var i=0,l=this.points.length;i<l;i++){
			var point = this.points[i];
			if(point){
				ps.push(point.x+","+point.y);
			}
		}
		return ps.join(" ");
	};
	this.setPoints=function(points){
		this.points = points||[{x:0,y:0},{x:0,y:0}];
		this.apply({points:{value:this.getPoints()}});
	};
	this.move=this.setPoints;
	this.clone=function(){
		var sharp = new gSoft.flow.polyLine();
		sharp.setLocation(this.getLocation());
		sharp.setSize(this.getSize());
		sharp.setStroke(this.config.stroke);
		sharp.setStyle(this.config.style);
		sharp.setPoints(this.points);
		return sharp;
		
	};
	this.hidden=function(){
		this.setPoints({x:0,y:0},{x:0,y:0});
	};
	this.toString = function(){
		var line = "";
		var tag = this.getTag();
		var points = this.linkAttr("points",this.getPoints());
		var stroke = this.getStrokeTag();
		var line = tag[0].substring(0,tag[0].length-1)+" "+points+">"+stroke+tag[1];
		return line;
	};
}
gSoft.flow.polyLine.prototype = new gSoft.flow.sharp;

gSoft.flow.roundRect=function(config){
	this.config = {
		fill:{
			//filled:"true",
			//color:"#000000"
		},
		style:{
			position:"absolute",
			zIndex:gSoft.method.getUniquezIndex(),
			left:config.left||0,
			top:config.top||0,
			width:config.width||120,
			height:config.height||50
		},
		shadow:{
			on:true,
			type:"single",
			color:"#b3b3b3",
			offset:"5px,5px"
		},
		textbox:{
			inset:"5pt,5pt,5pt,5pt",
			style:"font-size:10.2pt;",
			text:config.name||""
		}
		
	};
	this.tag = "roundrect";
	this.id = gSoft.method.getUniqueId(config.id);
	this.name = this.config.textbox.text;
	this.isDrag = config.isDrag || true;
	
	this.drag=function(position){
		event.cancelBubble = true;
		this.setLocation(position);
		var routes = flow.getRoutesByNodeId(this.id);
		var rs = null;
		for(var j=0;j<2;j++){
			if(j==0) rs = routes.from;
			else rs = routes.to;
			for(var i=0,l=rs.length;i<l;i++){
				var route = rs[i];
				if(!route) continue;
				if(route.sharp){
					if(j==0){
						var point = flow.getRoutePointsByNodes(this,null);
						route.sharp.setFrom(point.from);
					}else{
						var point = flow.getRoutePointsByNodes(null,this);
						route.sharp.setTo(point.to);
					}
					var size = {width:10,height:10};
					var position = flow.getControlPointsByRoute(route.sharp,size);
					var oval = flow.getControlSharpByRouteId(route.sharp.id);
					if(oval){
						oval.setLocation(position);
					}
					
				}
			}
		}
		
	};
	
}
gSoft.flow.roundRect.prototype = new gSoft.flow.sharp;

gSoft.flow.oval = function(config){
	this.config = {
		fill:{
			filled:"true",
			color:"#000000"
		},
		style:{
			position:"absolute",
			left:config.left||0,
			top:config.top||0,
			width:config.width||10,
			height:config.height||10
		}

		
	};
	this.tag = "oval";
	this.id = gSoft.method.getUniqueId(config.id);
	this.isDrag = config.isDrag || false;

}
gSoft.flow.oval.prototype = new gSoft.flow.sharp;



⌨️ 快捷键说明

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