📄 vml.js
字号:
this.lastControl = {}; return p;}, _vLineToA:function (segment, last) { var p = [" l"]; var n = segment.args; var l = n.length; var x = " " + last.x.toFixed(); for (var i = 0; i < l; ++i) { p.push(x); p.push(" "); p.push(n[i].toFixed()); } this.lastControl = {}; return p;}, _vLineToR:function (segment) { var p = [" r"]; var n = segment.args; var l = n.length; for (var i = 0; i < l; ++i) { p.push(" 0 "); p.push(n[i].toFixed()); } this.lastControl = {}; return p;}, _curveToA:function (segment) { var p = []; var n = segment.args; var l = n.length; for (var i = 0; i < l; i += 6) { p.push(" c"); this._addArgs(p, n, i, i + 6); } this.lastControl = {x:n[l - 4], y:n[l - 3], type:"C"}; return p;}, _curveToR:function (segment, last) { var p = []; var n = segment.args; var l = n.length; for (var i = 0; i < l; i += 6) { p.push(" v"); this._addArgs(p, n, i, i + 6); this.lastControl = {x:last.x + n[i + 2], y:last.y + n[i + 3]}; last.x += n[i + 4]; last.y += n[i + 5]; } this.lastControl.type = "C"; return p;}, _smoothCurveToA:function (segment, last) { var p = []; var n = segment.args; var l = n.length; for (var i = 0; i < l; i += 4) { p.push(" c"); if (this.lastControl.type == "C") { this._addArgs(p, [2 * last.x - this.lastControl.x, 2 * last.y - this.lastControl.y]); } else { this._addArgs(p, [last.x, last.y]); } this._addArgs(p, n, i, i + 4); } this.lastControl = {x:n[l - 4], y:n[l - 3], type:"C"}; return p;}, _smoothCurveToR:function (segment, last) { var p = []; var n = segment.args; var l = n.length; for (var i = 0; i < l; i += 4) { p.push(" v"); if (this.lastControl.type == "C") { this._addArgs(p, [last.x - this.lastControl.x, last.y - this.lastControl.y]); } else { this._addArgs(p, [0, 0]); } this._addArgs(p, n, i, i + 4); this.lastControl = {x:last.x + n[i], y:last.y + n[i + 1]}; last.x += n[i + 2]; last.y += n[i + 3]; } this.lastControl.type = "C"; return p;}, _qCurveToA:function (segment) { var p = []; var n = segment.args; var l = n.length; for (var i = 0; i < l; i += 4) { p.push(" qb"); this._addArgs(p, n, i, i + 4); } this.lastControl = {x:n[l - 4], y:n[l - 3], type:"Q"}; return p;}, _qCurveToR:function (segment, last) { var p = []; var n = segment.args; var l = n.length; for (var i = 0; i < l; i += 4) { p.push(" qb"); this._addArgsAdjusted(p, last, n, i, i + 4); this.lastControl = {x:last.x + n[i], y:last.y + n[i + 1]}; last.x += n[i + 2]; last.y += n[i + 3]; } this.lastControl.type = "Q"; return p;}, _qSmoothCurveToA:function (segment, last) { var p = []; var n = segment.args; var l = n.length; for (var i = 0; i < l; i += 2) { p.push(" qb"); if (this.lastControl.type == "Q") { this._addArgs(p, [this.lastControl.x = 2 * last.x - this.lastControl.x, this.lastControl.y = 2 * last.y - this.lastControl.y]); } else { this._addArgs(p, [this.lastControl.x = last.x, this.lastControl.y = last.y]); } this._addArgs(p, n, i, i + 2); } this.lastControl.type = "Q"; return p;}, _qSmoothCurveToR:function (segment, last) { var p = []; var n = segment.args; var l = n.length; for (var i = 0; i < l; i += 2) { p.push(" qb"); if (this.lastControl.type == "Q") { this._addArgs(p, [this.lastControl.x = 2 * last.x - this.lastControl.x, this.lastControl.y = 2 * last.y - this.lastControl.y]); } else { this._addArgs(p, [this.lastControl.x = last.x, this.lastControl.y = last.y]); } this._addArgsAdjusted(p, last, n, i, i + 2); } this.lastControl.type = "Q"; return p;}, _PI4:Math.PI / 4, _curvePI4:dojo.gfx.path._calcArc(Math.PI / 8), _calcArcTo:function (path, last, rx, ry, xRotg, large, cw, x, y) { var m = dojo.gfx.matrix; var xRot = -dojo.math.degToRad(xRotg); var rx2 = rx * rx; var ry2 = ry * ry; var pa = m.multiplyPoint(m.rotate(-xRot), {x:(last.x - x) / 2, y:(last.y - y) / 2}); var pax2 = pa.x * pa.x; var pay2 = pa.y * pa.y; var c1 = Math.sqrt((rx2 * ry2 - rx2 * pay2 - ry2 * pax2) / (rx2 * pay2 + ry2 * pax2)); var ca = {x:c1 * rx * pa.y / ry, y:-c1 * ry * pa.x / rx}; if (large == cw) { ca = {x:-ca.x, y:-ca.y}; } var c = m.multiplyPoint([m.translate((last.x + x) / 2, (last.y + y) / 2), m.rotate(xRot)], ca); var startAngle = Math.atan2(c.y - last.y, last.x - c.x) - xRot; var endAngle = Math.atan2(c.y - y, x - c.x) - xRot; var theta = cw ? startAngle - endAngle : endAngle - startAngle; if (theta < 0) { theta += this._2PI; } else { if (theta > this._2PI) { theta = this._2PI; } } var elliptic_transform = m.normalize([m.translate(c.x, c.y), m.rotate(xRot), m.scale(rx, ry)]); var alpha = this._PI4 / 2; var curve = this._curvePI4; var step = cw ? -alpha : alpha; for (var angle = theta; angle > 0; angle -= this._PI4) { if (angle < this._PI4) { alpha = angle / 2; curve = dojo.gfx.path._calcArc(alpha); step = cw ? -alpha : alpha; } var c1, c2, e; var M = m.normalize([elliptic_transform, m.rotate(startAngle + step)]); if (cw) { c1 = m.multiplyPoint(M, curve.c2); c2 = m.multiplyPoint(M, curve.c1); e = m.multiplyPoint(M, curve.s); } else { c1 = m.multiplyPoint(M, curve.c1); c2 = m.multiplyPoint(M, curve.c2); e = m.multiplyPoint(M, curve.e); } path.push(" c"); this._addArgs(path, [c1.x, c1.y, c2.x, c2.y, e.x, e.y]); startAngle += 2 * step; }}, _arcTo:function (segment, last) { var p = []; var n = segment.args; var l = n.length; var relative = segment.action == "a"; for (var i = 0; i < l; i += 7) { var x1 = n[i + 5]; var y1 = n[i + 6]; if (relative) { x1 += last.x; y1 += last.y; } this._calcArcTo(p, last, n[i], n[i + 1], n[i + 2], n[i + 3] ? 1 : 0, n[i + 4] ? 1 : 0, x1, y1); last = {x:x1, y:y1}; } this.lastControl = {}; return p;}, _closePath:function () { this.lastControl = {}; return ["x"];}});dojo.gfx.Path.nodeType = "shape";dojo.gfx._creators = {createPath:function (path) { return this.createObject(dojo.gfx.Path, path, true);}, createRect:function (rect) { return this.createObject(dojo.gfx.Rect, rect);}, createCircle:function (circle) { return this.createObject(dojo.gfx.Circle, circle);}, createEllipse:function (ellipse) { return this.createObject(dojo.gfx.Ellipse, ellipse);}, createLine:function (line) { return this.createObject(dojo.gfx.Line, line, true);}, createPolyline:function (points) { return this.createObject(dojo.gfx.Polyline, points, true);}, createImage:function (image) { if (!this.rawNode) { return null; } var shape = new dojo.gfx.Image(); var node = document.createElement("div"); node.style.position = "relative"; node.style.width = this.rawNode.style.width; node.style.height = this.rawNode.style.height; node.style.filter = "progid:DXImageTransform.Microsoft.Matrix(M11=1, M12=0, M21=0, M22=1, Dx=0, Dy=0)"; var img = document.createElement("img"); node.appendChild(img); shape.setRawNode(node); this.rawNode.appendChild(node); shape.setShape(image); this.add(shape); return shape;}, createGroup:function () { return this.createObject(dojo.gfx.Group, null, true);}, createObject:function (shapeType, rawShape, overrideSize) { if (!this.rawNode) { return null; } var shape = new shapeType(); var node = document.createElement("v:" + shapeType.nodeType); shape.setRawNode(node); this.rawNode.appendChild(node); if (overrideSize) { this._overrideSize(node); } shape.setShape(rawShape); this.add(shape); return shape;}, _overrideSize:function (node) { node.style.width = this.rawNode.style.width; node.style.height = this.rawNode.style.height; node.coordsize = parseFloat(node.style.width) + " " + parseFloat(node.style.height);}};dojo.lang.extend(dojo.gfx.Group, dojo.gfx._creators);dojo.lang.extend(dojo.gfx.Surface, dojo.gfx._creators);delete dojo.gfx._creators;dojo.gfx.attachNode = function (node) { if (!node) { return null; } var s = null; switch (node.tagName.toLowerCase()) { case dojo.gfx.Rect.nodeType: s = new dojo.gfx.Rect(); break; case dojo.gfx.Ellipse.nodeType: s = (node.style.width == node.style.height) ? new dojo.gfx.Circle() : new dojo.gfx.Ellipse(); break; case dojo.gfx.Path.nodeType: switch (node.getAttribute("dojoGfxType")) { case "line": s = new dojo.gfx.Line(); break; case "polyline": s = new dojo.gfx.Polyline(); break; case "path": s = new dojo.gfx.Path(); break; } break; case dojo.gfx.Image.nodeType: s = new dojo.gfx.Image(); break; default: dojo.debug("FATAL ERROR! tagName = " + node.tagName); } s.attach(node); return s;};dojo.lang.extend(dojo.gfx.Surface, {setDimensions:function (width, height) { if (!this.rawNode) { return this; } this.rawNode.style.width = width; this.rawNode.style.height = height; this.rawNode.coordsize = width + " " + height; return this;}, getDimensions:function () { return this.rawNode ? {width:this.rawNode.style.width, height:this.rawNode.style.height} : null;}, add:function (shape) { var oldParent = shape.getParent(); if (this != oldParent) { this.rawNode.appendChild(shape.rawNode); if (oldParent) { oldParent.remove(shape, true); } shape._setParent(this, null); } return this;}, remove:function (shape, silently) { if (this == shape.getParent()) { if (this.rawNode == shape.rawNode.parentNode) { this.rawNode.removeChild(shape.rawNode); } shape._setParent(null, null); } return this;}});dojo.gfx.createSurface = function (parentNode, width, height) { var s = new dojo.gfx.Surface(); s.rawNode = document.createElement("v:group"); s.rawNode.style.width = width ? width : "100%"; s.rawNode.style.height = height ? height : "100%"; s.rawNode.coordsize = (width && height) ? (parseFloat(width) + " " + parseFloat(height)) : "100% 100%"; s.rawNode.coordorigin = "0 0"; dojo.byId(parentNode).appendChild(s.rawNode); return s;};dojo.gfx.attachSurface = function (node) { var s = new dojo.gfx.Surface(); s.rawNode = node; return s;};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -