flymis/WebRoot/dojojs/src/gfx/path.js
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.gfx.path");
dojo.require("dojo.math");
dojo.require("dojo.gfx.shape");
dojo.declare("dojo.gfx.path.Path", dojo.gfx.Shape, {
// summary:
// a path shape
initializer: function(/* Node */ rawNode){
// summary: a constructor of a path shape object
// rawNode: a DOM node to be used by this path object
this.shape = dojo.lang.shallowCopy(dojo.gfx.defaultPath, true);
this.segments = [];
this.absolute = true;
this.last = {};
this.attach(rawNode);
},
// mode manipulations
setAbsoluteMode: function(/* Boolean||String */ mode){
// summary: sets an absolute or relative mode for path points
// mode: true/false or "absolute"/"relative" to specify the mode
this.absolute = typeof(mode) == "string" ? (mode == "absolute") : mode;
return this; // self
},
getAbsoluteMode: function(){
// summary: returns a current value of the absolute mode
return this.absolute; // Boolean
},
getBoundingBox: function(){
// summary: returns a bounding box {x, y, width, height} or null
return "l" in this.bbox ? {x: this.bbox.l, y: this.bbox.t, width: this.bbox.r - this.bbox.l, height: this.bbox.b - this.bbox.t} : null; // Object
},
getLastPosition: function(){
// summary: returns the last point in the path, or null
return "x" in this.last ? this.last : null; // Object
},
// segment interpretation
_updateBBox: function(/* Number */ x, /* Number */ y){
// summary: updates a bounding box of path with new point
// we use {l, b, r, t} representation of a bbox
if("l" in this.bbox){
if(this.bbox.l > x) this.bbox.l = x;
if(this.bbox.r < x) this.bbox.r = x;
if(this.bbox.t > y) this.bbox.t = y;
if(this.bbox.b < y) this.bbox.b = y;
}else{
后面还有 260 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。