芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/cepali/question/type/ddmarker/amd/build/shapes.min.js
define(function(){"use strict";function a(a,b){this.x=a,this.y=b}function b(b,c,d){this.label=b,this.centre=new a(c||0,d||0)}function c(a,c,d,e){c=c||15,d=d||15,b.call(this,a,c,d),this.radius=e||15}function d(a,c,d,e,f){b.call(this,a,c,d),this.width=e||30,this.height=f||30}function e(c,d){b.call(this,c,0,0),this.points=d?d.slice():[new a(10,10),new a(40,10),new a(10,40)],this.normalizeShape()}function f(a){b.call(this,a)}function g(a,b){var c=a.ownerDocument.createElementNS("http://www.w3.org/2000/svg",b);return a.appendChild(c),c}function h(a,b){var c=g(a,"g");return g(c,b).setAttribute("class","shape"),g(c,"text").setAttribute("class","shapeLabel"),c}return a.prototype.toString=function(){return this.x+","+this.y},a.prototype.move=function(a,b){this.x+=a,this.y+=b},a.prototype.offset=function(b,c){return b instanceof a&&(c=b.y,b=b.x),new a(this.x+b,this.y+c)},a.parse=function(b){var c=b.split(",");if(2!==c.length)throw new Error(b+" is not a valid point");return new a(Math.round(c[0]),Math.round(c[1]))},b.prototype.getType=function(){throw new Error("Not implemented.")},b.prototype.getCoordinates=function(){throw new Error("Not implemented.")},b.prototype.parse=function(a){throw new Error("Not implemented.")},b.prototype.move=function(a,b,c,d){},b.prototype.edit=function(a,b,c,d,e){},b.prototype.normalizeShape=function(){},b.prototype.makeSvg=function(a){throw new Error("Not implemented.")},b.prototype.updateSvg=function(a){},b.prototype.makeSimilarCircle=function(){throw new Error("Not implemented.")},b.prototype.makeSimilarRectangle=function(){throw new Error("Not implemented.")},b.prototype.makeSimilarPolygon=function(){throw new Error("Not implemented.")},b.prototype.getHandlePositions=function(){return null},c.prototype=new b,c.prototype.getType=function(){return"circle"},c.prototype.getCoordinates=function(){return this.centre+";"+Math.abs(this.radius)},c.prototype.makeSvg=function(a){var b=h(a,"circle");return this.updateSvg(b),b},c.prototype.updateSvg=function(a){a.childNodes[0].setAttribute("cx",this.centre.x),a.childNodes[0].setAttribute("cy",this.centre.y),a.childNodes[0].setAttribute("r",Math.abs(this.radius)),a.childNodes[1].setAttribute("x",this.centre.x),a.childNodes[1].setAttribute("y",this.centre.y+15),a.childNodes[1].textContent=this.label},c.prototype.parse=function(b){if(!b.match(/^\d+,\d+;\d+$/))return!1;var c=b.split(";");return this.centre=a.parse(c[0]),this.radius=Math.round(c[1]),!0},c.prototype.move=function(a,b,c,d){this.centre.move(a,b),this.centre.x
c-this.radius&&(this.centre.x=c-this.radius),this.centre.y
d-this.radius&&(this.centre.y=d-this.radius)},c.prototype.edit=function(a,b,c,d,e){this.radius+=b;var f=Math.min(this.centre.x,this.centre.y,d-this.centre.x,e-this.centre.y);this.radius>f&&(this.radius=f),this.radius<-f&&(this.radius=-f)},c.prototype.normalizeShape=function(){this.radius=Math.abs(this.radius)},c.prototype.makeSimilarRectangle=function(){return new d(this.label,this.centre.x-this.radius,this.centre.y-this.radius,2*this.radius,2*this.radius)},c.prototype.makeSimilarPolygon=function(){return new e(this.label,[this.centre.offset(-this.radius,-this.radius),this.centre.offset(-this.radius,this.radius),this.centre.offset(this.radius,this.radius),this.centre.offset(this.radius,-this.radius)])},c.prototype.getHandlePositions=function(){return{moveHandle:this.centre,editHandles:[this.centre.offset(this.radius,0)]}},d.prototype=new b,d.prototype.getType=function(){return"rectangle"},d.prototype.getCoordinates=function(){return this.centre+";"+this.width+","+this.height},d.prototype.makeSvg=function(a){var b=h(a,"rect");return this.updateSvg(b),b},d.prototype.updateSvg=function(a){this.width>=0?(a.childNodes[0].setAttribute("x",this.centre.x),a.childNodes[0].setAttribute("width",this.width)):(a.childNodes[0].setAttribute("x",this.centre.x+this.width),a.childNodes[0].setAttribute("width",-this.width)),this.height>=0?(a.childNodes[0].setAttribute("y",this.centre.y),a.childNodes[0].setAttribute("height",this.height)):(a.childNodes[0].setAttribute("y",this.centre.y+this.height),a.childNodes[0].setAttribute("height",-this.height)),a.childNodes[1].setAttribute("x",this.centre.x+this.width/2),a.childNodes[1].setAttribute("y",this.centre.y+this.height/2+15),a.childNodes[1].textContent=this.label},d.prototype.parse=function(b){if(!b.match(/^\d+,\d+;\d+,\d+$/))return!1;var c=b.split(";");this.centre=a.parse(c[0]);var d=a.parse(c[1]);return this.width=d.x,this.height=d.y,!0},d.prototype.move=function(a,b,c,d){this.centre.move(a,b),this.centre.x<0&&(this.centre.x=0),this.centre.x>c-this.width&&(this.centre.x=c-this.width),this.centre.y<0&&(this.centre.y=0),this.centre.y>d-this.height&&(this.centre.y=d-this.height)},d.prototype.edit=function(a,b,c,d,e){this.width+=b,this.height+=c,this.width<-this.centre.x&&(this.width=-this.centre.x),this.width>d-this.centre.x&&(this.width=d-this.centre.x),this.height<-this.centre.y&&(this.height=-this.centre.y),this.height>e-this.centre.y&&(this.height=e-this.centre.y)},d.prototype.normalizeShape=function(){this.width<0&&(this.centre.x+=this.width,this.width=-this.width),this.height<0&&(this.centre.y+=this.height,this.height=-this.height)},d.prototype.makeSimilarCircle=function(){return new c(this.label,Math.round(this.centre.x+this.width/2),Math.round(this.centre.y+this.height/2),Math.round((this.width+this.height)/4))},d.prototype.makeSimilarPolygon=function(){return new e(this.label,[this.centre,this.centre.offset(0,this.height),this.centre.offset(this.width,this.height),this.centre.offset(this.width,0)])},d.prototype.getHandlePositions=function(){return{moveHandle:this.centre.offset(this.width/2,this.height/2),editHandles:[this.centre.offset(this.width,this.height)]}},e.prototype=new b,e.prototype.getType=function(){return"polygon"},e.prototype.getCoordinates=function(){for(var a="",b=0;b
c-f&&(this.centre.x=c-f),this.centre.y<-g&&(this.centre.y=-g),this.centre.y>d-h&&(this.centre.y=d-h)},e.prototype.edit=function(a,b,c,d,e){this.points[a].move(b,c),this.points[a].x<-this.centre.x&&(this.points[a].x=-this.centre.x),this.points[a].x>d-this.centre.x&&(this.points[a].x=d-this.centre.x),this.points[a].y<-this.centre.y&&(this.points[a].y=-this.centre.y),this.points[a].y>e-this.centre.y&&(this.points[a].y=e-this.centre.y)},e.prototype.addNewPointAfter=function(b){this.points.splice(b,0,new a(this.points[b].x,this.points[b].y))},e.prototype.normalizeShape=function(){var a,b=0,c=0;if(0!==this.points.length){for(a=0;a