diff --git a/Gruntfile.js b/Gruntfile.js index bf5c483..0dcad30 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,119 +1,66 @@ /*global module:false*/ module.exports = function(grunt) { + var banner = '/*!\n' + + ' * ====================================================\n' + + ' * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + + '<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' + + ' * GitHub: <%= pkg.repository.url %> \n' + + ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' + + ' * ====================================================\n' + + ' */\n\n'; + // Project configuration. grunt.initConfig({ // Metadata. pkg: grunt.file.readJSON('package.json'), - // Task configuration. - transport: { - + dependence: { options: { - - // module path - paths: [ 'src' ], - debug: false - + entrance: 'kity', + base: 'src' }, - - cmd: { - - files: [ { - - cwd: 'src', - src: '**/*.js', - dest: '.build_tmp' - - } ] - + merge: { + files: [{ + src: 'src/**/*.js', + dest: '.build_tmp/kity_tmp.js' + }] } - }, concat: { - - options: { - - paths: [ 'src' ], - include: 'all', - noncmd: true - - }, - - cmd: { - - files: { - '.build_tmp/kity-non.js': '.build_tmp/**/*.js' - } - - }, - - full: { - + closure: { options: { - - banner: '/*!\n' + - ' * ====================================================\n' + - ' * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + - '<%= grunt.template.today("yyyy-mm-dd") %>\n' + - '<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' + - ' * GitHub: <%= pkg.repository.url %> \n' + - ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + - ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' + - ' * ====================================================\n' + - ' */\n\n' + - '(function () {\n', - + banner: banner + '(function () {\n', footer: '})();' - }, - files: { - 'dist/kity.js': [ 'dev-lib/cmd-define.js', '.build_tmp/kity-non.js', 'dev-lib/exports.js' ] + 'dist/kity.js': ['.build_tmp/kity_tmp.js', 'dev-lib/exports.js'] } - } - }, uglify: { - options: { - - banner: '/*!\n' + - ' * ====================================================\n' + - ' * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + - '<%= grunt.template.today("yyyy-mm-dd") %>\n' + - '<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' + - ' * GitHub: <%= pkg.repository.url %> \n' + - ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + - ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' + - ' * ====================================================\n' + - ' */\n' - + banner: banner }, - minimize: { - files: { 'dist/kity.min.js': 'dist/kity.js' } - } - }, clean: { - - tmp: [ '.build_tmp' ] - + tmp: ['.build_tmp'] }, jasmine: { - kity: { - src: ['dev-lib/cmd-define.js', 'dist/kity.min.js'], + unit: { + src: ['dist/kity.min.js'], options: { specs: [ 'spec/core/*', @@ -126,7 +73,7 @@ module.exports = function(grunt) { }, connect: { - kity: { + unit: { options: { hostname: '0.0.0.0', port: 7777, @@ -138,16 +85,15 @@ module.exports = function(grunt) { }); // These plugins provide necessary tasks. - grunt.loadNpmTasks('grunt-cmd-transport'); - grunt.loadNpmTasks('grunt-cmd-concat'); + grunt.loadNpmTasks('grunt-module-dependence'); + grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-jasmine'); - grunt.loadNpmTasks('grunt-contrib-connect'); // Default task. - grunt.registerTask('default', ['transport:cmd', 'concat:cmd', 'concat:full', 'uglify:minimize', 'clean:tmp']); - grunt.registerTask('test', ['default', 'connect:kity', 'jasmine:kity']); + grunt.registerTask('default', ['dependence:merge', 'concat:closure', 'uglify:minimize', 'clean:tmp']); + grunt.registerTask('test', ['default', 'connect:unit', 'jasmine:unit']); -}; +}; \ No newline at end of file diff --git a/demo/README.md b/demo/README.md new file mode 100644 index 0000000..57a1a7d --- /dev/null +++ b/demo/README.md @@ -0,0 +1,75 @@ +Kity Demo 编写规范 +===== + +本目录存放 Kity 的 Demo,需要贡献 Demo 的,请遵守本规范。 + +## Demo 类型 + +Demo 允许以单个 HTML 页面存在,也可以以目录的形式存在。 + +如果 Demo 以目录的形式存在,Demo 的入口*必须是 index.html* 。可以在 Demo 目录中存放该 Demo 所需要的资源。但是如果资源可能能被其他 Demo 复用,那么应该把资源存放在 `public` 目录下。 + +## 页面结构 + +单页面的 Demo,或者目录形式的 Demo 的 index.html,应该遵循以下页面结构。 + +```html + + + + + + + + + + + + + + Demo 标题 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +## 其他说明 + +1. 如果 Demo 在开发中,那么应该给 Demo 文件名或目录名前面加一个下划线,表示 Demo 不会被扫描发布。 +2. `_sample.html` 是上述页面结构的源文件,开始一个新 Demo 可以从拷贝修改该文件开始。 +3. 贡献了 Demo,请给我们提 pull request。欢迎一起丰富 kity 的 Demo 库! \ No newline at end of file diff --git a/demo/_sample.html b/demo/_sample.html new file mode 100644 index 0000000..5cee565 --- /dev/null +++ b/demo/_sample.html @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + Demo 标题 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo/text.html b/demo/_text.html similarity index 96% rename from demo/text.html rename to demo/_text.html index dc1f57e..f4e2ff3 100644 --- a/demo/text.html +++ b/demo/_text.html @@ -28,7 +28,7 @@ paper.addShape(p); setInterval(function() { - var box = t.getRenderBox(); + var box = t.getRenderBox('top'); rb.setPosition(box.x, box.y).setSize(box.width, box.height); }, 15); diff --git a/demo/bran_test.html b/demo/bran_test.html deleted file mode 100644 index 9a103c6..0000000 --- a/demo/bran_test.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - Color Ring - - - - - - - \ No newline at end of file diff --git a/demo/chinamap.html b/demo/chinamap.html deleted file mode 100644 index 3744918..0000000 --- a/demo/chinamap.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - Color Ring - - - - - - - \ No newline at end of file diff --git a/demo/chinamap/index.html b/demo/chinamap/index.html new file mode 100644 index 0000000..b193a49 --- /dev/null +++ b/demo/chinamap/index.html @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + 中国地图 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo/clock.html b/demo/clock.html index 4bafe2d..13a60d1 100644 --- a/demo/clock.html +++ b/demo/clock.html @@ -1,189 +1,40 @@ - A Kity Clock - - - + + + + + + + + + + + Kity Clock + + + + - - - - - - - + + + + + + + + - - -
- - \ No newline at end of file diff --git a/demo/force-chart/demo.html b/demo/force-chart/demo.html deleted file mode 100644 index 3386cb2..0000000 --- a/demo/force-chart/demo.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - Force Chart - - - - - - - - \ No newline at end of file diff --git a/demo/force-chart/index.html b/demo/force-chart/index.html new file mode 100644 index 0000000..8f65c25 --- /dev/null +++ b/demo/force-chart/index.html @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + 力导向图 + + + + + + + + + + \ No newline at end of file diff --git a/demo/connection/bezierconnection.js b/demo/graffle/bezierconnection.js similarity index 89% rename from demo/connection/bezierconnection.js rename to demo/graffle/bezierconnection.js index 61f4484..e5b3eea 100644 --- a/demo/connection/bezierconnection.js +++ b/demo/graffle/bezierconnection.js @@ -83,8 +83,8 @@ define(function (require, exports, module) { } } return { - start: nearStart, - end: nearEnd + start: new Vector(nearStart.x, nearStart.y), + end: new Vector(nearEnd.x, nearEnd.y) }; }, updateConnection: function() { @@ -100,13 +100,11 @@ define(function (require, exports, module) { var pointVector = Vector.fromPoints( startEnd, endEnd ); - var forward = Vector.projection( pointVector, startEnd.normal ); - var backward = Vector.projection( Vector.reverse(pointVector), endEnd.normal ); + var forward = pointVector.project(startEnd.normal); + var backward = pointVector.reverse().project(endEnd.normal); - forward = Vector.multipy( forward, 0.5 ); - forward = Vector.add( startEnd, forward ); - backward = Vector.multipy( backward, 0.5 ); - backward = Vector.add( endEnd, backward ); + forward = startEnd.add(forward.multipy(0.5)); + backward = endEnd.add(backward.multipy(0.5)); this.startBesierPoint.setVertex(startEnd.x, startEnd.y); this.startBesierPoint.setForward(forward.x, forward.y); diff --git a/demo/graffle.html b/demo/graffle/index.html similarity index 87% rename from demo/graffle.html rename to demo/graffle/index.html index c71cc9c..ca01af8 100644 --- a/demo/graffle.html +++ b/demo/graffle/index.html @@ -1,18 +1,41 @@ + + + + + + + + + + + Graffle - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/demo/index.html b/demo/index.html deleted file mode 100644 index 23b0316..0000000 --- a/demo/index.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - Kity Demo List - - - -

Kity Demo List

- -
- -
- - \ No newline at end of file diff --git a/demo/kitychart/charts/chinamap.js b/demo/kitychart/charts/chinamap.js index 6906ff7..fabc173 100644 --- a/demo/kitychart/charts/chinamap.js +++ b/demo/kitychart/charts/chinamap.js @@ -90,7 +90,6 @@ var ChinaMap = kity.createClass('ChinaMap', { } this.width = data.width; this.height = data.height; - this.setAnchor(0, 0); }, setWidth: function(width) { diff --git a/demo/kitychart/charts/gender-chart.js b/demo/kitychart/charts/gender-chart.js index c35d5f4..cca5543 100644 --- a/demo/kitychart/charts/gender-chart.js +++ b/demo/kitychart/charts/gender-chart.js @@ -29,7 +29,10 @@ var KCGenderChart = kity.createClass("GenderChart", (function() { rect2.fill(color); _paper.addShape(group); group.addShapes([polygon1, rect2]); - group.translate(me.centerX + me.R + 10, me.centerY).setAnchor(me.centerX, me.centerY).rotate(rotate); + group.translate(me.centerX + me.R + 10, me.centerY) + .translate(-me.centerX, -me.centerY) + .rotate(rotate) + .translate(me.centerX, me.centerY); }; //绘制十字 var drawCross = function(color, rotate) { @@ -40,7 +43,10 @@ var KCGenderChart = kity.createClass("GenderChart", (function() { rect1.fill(color); rect2.fill(color); group.addShapes([rect1, rect2]); - group.translate(me.centerX + me.R + 10, me.centerY).setAnchor(me.centerX, me.centerY).rotate(rotate); + group.translate(me.centerX + me.R + 10, me.centerY) + .translate(-me.centerX, -me.centerY) + .rotate(rotate) + .translate(me.centerX, me.centerY); _paper.addShape(group); }; var renderPie = function(pMale, pFemale) { diff --git a/demo/kitychart/charts/line-chart.js b/demo/kitychart/charts/line-chart.js index 7e1528e..4a4704e 100644 --- a/demo/kitychart/charts/line-chart.js +++ b/demo/kitychart/charts/line-chart.js @@ -14,7 +14,7 @@ var MarkDot = kity.createClass("MarkDot", { this.text.setContent(content); }, updatePosition: function(x, y, bx, by) { - this.setTransform(new kity.Matrix().translate(x, y)); + this.setTranslate(x, y); var rb = this.text.getRenderBox(); var tx, ty, margin = 15; @@ -27,7 +27,7 @@ var MarkDot = kity.createClass("MarkDot", { tx = margin; } ty = -rb.height / 2; - this.text.setTransform(new kity.Matrix().translate(tx, ty + rb.height - 2)); + this.text.setTranslate(tx, ty + rb.height - 2); var f = snapToSharp; this.rect.setPosition(f(tx) - 5, f(ty) - 5); this.rect.setSize((rb.width | 0) + 10, (rb.height | 0) + 10); @@ -80,12 +80,14 @@ var KCLineChart = kity.createClass("lineChart", (function() { })); //绘制label for (var j = 0; j < 17; j++) { - var vX = 10.5 + j * duraction; + var vX = 15.5 + j * duraction; var _label = new kity.Text(labels[j]); _label - .setX(vX).setY(drawArea.bottom + 30).setSize(12).setStyle("font-family", "Arial").fill(p.get('alix-text')); + .setX(vX).setY(drawArea.bottom + 10).setSize(12).setStyle("font-family", "Arial").fill(p.get('alix-text')); _paper.addShape(_label); - _label.rotate(-60); + _label.translate(-_label.getX(), -_label.getY()) + .rotate(60) + .translate(_label.getX(), _label.getY()); } }; //根据设定的最大值和最小值绘制折线图 @@ -140,8 +142,8 @@ var KCLineChart = kity.createClass("lineChart", (function() { for (var i = 0; i < origin.length; i++) { for (var j = 0; j < origin[i].length; j++) { var p = origin[i][j]; - series[j] = series[j] || [p.getX()]; - series[j].push(p.getY()); + series[j] = series[j] || [p.x]; + series[j].push(p.y); } } return series; @@ -183,7 +185,7 @@ var KCLineChart = kity.createClass("lineChart", (function() { var x = e.getPosition().x; var points = findNearestPoint(x); x = Math.floor(points[0]); - xRuler.setTransform(new kity.Matrix().translate(x, 0)); + xRuler.setTranslate(x, 0); for (var i = 1; i < points.length; i++) { iDots[i - 1].setText((points[0] | 0) + ', ' + (points[i] | 0)); iDots[i - 1].updatePosition(points[0], points[i], me.paperWidth - 100, me.paperHeight); diff --git a/demo/kitychart/charts/pie.js b/demo/kitychart/charts/pie.js index eaa544f..2a2def2 100644 --- a/demo/kitychart/charts/pie.js +++ b/demo/kitychart/charts/pie.js @@ -3,20 +3,20 @@ var kityPie = kity.createClass({ constructor: function(r, R, a1, a2, x, y) { this.callBase(); this.draw(r, R, a1, a2, x, y); - this.center = kity.Vector.fromPolar((R + r) / 2, (a1 + a2) / 2); + this.center = kity.Point.fromPolar((R + r) / 2, (a1 + a2) / 2); }, draw: function(r, R, a1, a2, x, y) { var d = this.getDrawer(); - var p1 = kity.Vector.fromPolar(r, a1), - p2 = kity.Vector.fromPolar(R, a1), - p3 = kity.Vector.fromPolar(R, a2), - p4 = kity.Vector.fromPolar(r, a2); + var p1 = kity.Point.fromPolar(r, a1), + p2 = kity.Point.fromPolar(R, a1), + p3 = kity.Point.fromPolar(R, a2), + p4 = kity.Point.fromPolar(r, a2); d.moveTo(p1.x + x, p1.y + y); d.lineTo(p2.x + x, p2.y + y); var dir = Math.abs(a2 - a1) > 180 ? 1 : 0; - d.carcTo(R, p3.x + x, p3.y + y, dir, 1); + d.carcTo(R, dir, 1, p3.x + x, p3.y + y); d.lineTo(p4.x + x, p4.y + y); - d.carcTo(r, p1.x + x, p1.y + y, dir); + d.carcTo(r, dir, 0, p1.x + x, p1.y + y); d.close(); } }); \ No newline at end of file diff --git a/demo/kitychart/index.html b/demo/kitychart/index.html index a520245..cfbfd25 100644 --- a/demo/kitychart/index.html +++ b/demo/kitychart/index.html @@ -2,7 +2,20 @@ - + + + + + + + + + + + 数据可视化 + + + diff --git a/demo/pathdiagram/dataquery.js b/demo/pathdiagram/dataquery.js index 9a27db4..21b3b5c 100644 --- a/demo/pathdiagram/dataquery.js +++ b/demo/pathdiagram/dataquery.js @@ -16,7 +16,7 @@ define( function ( require, exports, module ) { } } return ret; - } )( require( './data' ) ); + } )( require( '../demo/pathdiagram/data' ) ); var length = data.length; var abs = Math.abs; diff --git a/demo/pathdiagram/index.html b/demo/pathdiagram/index.html index 778c0af..b327514 100644 --- a/demo/pathdiagram/index.html +++ b/demo/pathdiagram/index.html @@ -2,36 +2,38 @@ + + + + + + + + 搜索路径图 - + + + + + + - -

Kity Demo - 搜索路径图

-
- -
- + + \ No newline at end of file diff --git a/demo/pathdiagram/levelcontainer.js b/demo/pathdiagram/levelcontainer.js index 47b94c9..1439d84 100644 --- a/demo/pathdiagram/levelcontainer.js +++ b/demo/pathdiagram/levelcontainer.js @@ -1,12 +1,12 @@ define( function ( require, exports, module ) { var Group = require( 'graphic/group' ); - var Connection = require( '../connection/bezierconnection' ); - var Query = require( './dataquery' ); + var Connection = require( '../demo/graffle/bezierconnection' ); + var Query = require( '../demo/pathdiagram/dataquery' ); var Rect = require( 'graphic/rect' ); var Text = require( 'graphic/text' ); var TextSpan = require( 'graphic/textspan' ); - var PathNode = require( './pathnode' ); - var colors = require( './colors' ); + var PathNode = require( '../demo/pathdiagram/pathnode' ); + var colors = require( '../demo/pathdiagram/colors' ); var rHeight = 25; var rWidth = 250; diff --git a/demo/pathdiagram/pathdiagram.app.js b/demo/pathdiagram/pathdiagram.app.js index aa49ed0..f507d41 100644 --- a/demo/pathdiagram/pathdiagram.app.js +++ b/demo/pathdiagram/pathdiagram.app.js @@ -1,12 +1,12 @@ define(function (require, exports, module) { var Class = require('core/class'); var Paper = require('graphic/paper'); - var Draggable = require('../public/draggable'); - var PathDiagram = require('./pathdiagram'); + var Draggable = require('../demo/public/draggable'); + var PathDiagram = require('../demo/pathdiagram/pathdiagram'); Class.extendClass(Paper, Draggable); - var paper = new Paper('pathdiagram').drag(); + var paper = new Paper(document.body).drag(); paper.on('dragstart', function() { this.setStyle('cursor', '-webkit-grabbing'); @@ -14,8 +14,7 @@ define(function (require, exports, module) { this.setStyle('cursor', '-webkit-grab'); }).trigger('dragend'); - paper.setWidth(1200).setHeight(800); - paper.setViewBox(-600, -400, 1200, 800); + paper.setViewBox(-600.5, -400.5, 1200, 800); var keyword = /q=(.+)/.exec(window.location.href); keyword = keyword && keyword[1]; diff --git a/demo/pathdiagram/pathdiagram.js b/demo/pathdiagram/pathdiagram.js index f640395..8219814 100644 --- a/demo/pathdiagram/pathdiagram.js +++ b/demo/pathdiagram/pathdiagram.js @@ -1,11 +1,11 @@ define( function ( require, exports, module ) { var Class = require( 'core/class' ); - var Query = require( './dataquery' ); - var Connection = require( '../connection/bezierconnection' ); + var Query = require( '../demo/pathdiagram/dataquery' ); + var Connection = require( '../demo/graffle/bezierconnection' ); var Group = require( 'graphic/group' ); var Text = require( 'graphic/text' ); - var LevelContainer = require( './levelcontainer' ); - var colors = require( './colors' ); + var LevelContainer = require( '../demo/pathdiagram/levelcontainer' ); + var colors = require( '../demo/pathdiagram/colors' ); var R_SIZE = LevelContainer.RECT_SIZE; diff --git a/demo/pathdiagram/pathnode.js b/demo/pathdiagram/pathnode.js index fce3511..cd7bddb 100644 --- a/demo/pathdiagram/pathnode.js +++ b/demo/pathdiagram/pathnode.js @@ -3,7 +3,7 @@ define(function(require, exports, module) { var Rect = require('graphic/rect'); var Text = require('graphic/text'); var TextSpan = require('graphic/textspan'); - var colors = require('./colors'); + var colors = require('../demo/pathdiagram/colors'); return require('core/class').createClass({ base: Group, diff --git a/demo/ps-pen/demo.controller.js b/demo/ps-pen/demo.controller.js index 21b0a1c..c4de2c7 100644 --- a/demo/ps-pen/demo.controller.js +++ b/demo/ps-pen/demo.controller.js @@ -10,7 +10,7 @@ define( function ( require, exports, module ) { Utils = require( "core/utils" ), Vector = require( "graphic/vector" ), // 引入可绘制的点集合 - PointGroup = require( "./demo.pointgroup" ), + PointGroup = require( "../demo/ps-pen/demo.pointgroup" ), BezierPoint = require( "graphic/bezierpoint" ); diff --git a/demo/ps-pen/demo.start.js b/demo/ps-pen/demo.start.js index 4bc9712..8df57b0 100644 --- a/demo/ps-pen/demo.start.js +++ b/demo/ps-pen/demo.start.js @@ -15,7 +15,7 @@ define( function ( require, exports, module ) { //zoom倍数 ZOOM = 100, controller = null, - Controller = require( "./demo.controller" ); + Controller = require( "../demo/ps-pen/demo.controller" ); function init () { diff --git a/demo/ps-pen/index.html b/demo/ps-pen/index.html index 2e75c99..146b07b 100644 --- a/demo/ps-pen/index.html +++ b/demo/ps-pen/index.html @@ -1,20 +1,31 @@ - PS钢笔工具 + - - - - + + + +
@@ -27,4 +38,8 @@
+ \ No newline at end of file diff --git a/demo/jquery.js b/demo/public/jquery.js similarity index 100% rename from demo/jquery.js rename to demo/public/jquery.js diff --git a/demo/ringpalette.html b/demo/ringpalette.html deleted file mode 100644 index 756e6e4..0000000 --- a/demo/ringpalette.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - Color Ring - - - - - - - \ No newline at end of file diff --git a/demo/ringpalette/index.html b/demo/ringpalette/index.html new file mode 100644 index 0000000..2fc4aa6 --- /dev/null +++ b/demo/ringpalette/index.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + 取色器 + + + + + + + + + + + \ No newline at end of file diff --git a/demo/ringpalette/pie.js b/demo/ringpalette/pie.js index 84efb75..5777fc7 100644 --- a/demo/ringpalette/pie.js +++ b/demo/ringpalette/pie.js @@ -1,24 +1,24 @@ define(function(require, exports, module){ var Path = require('graphic/path'); - var Vector = require('graphic/vector'); + var Point = require('graphic/point'); return require('core/class').createClass({ base: Path, constructor: function(r, R, a1, a2) { this.callBase(); this.draw(r, R, a1, a2); - this.center = Vector.fromPolar( (R + r) / 2, (a1 + a2) / 2 ); + this.center = Point.fromPolar( (R + r) / 2, (a1 + a2) / 2 ); }, draw: function(r, R, a1, a2) { var d = this.getDrawer(); - var p1 = Vector.fromPolar(r, a1), - p2 = Vector.fromPolar(R, a1), - p3 = Vector.fromPolar(R, a2), - p4 = Vector.fromPolar(r, a2); + var p1 = Point.fromPolar(r, a1), + p2 = Point.fromPolar(R, a1), + p3 = Point.fromPolar(R, a2), + p4 = Point.fromPolar(r, a2); d.moveTo(p1.x, p1.y); d.lineTo(p2.x, p2.y); - d.carcTo(R, p3.x, p3.y, 0, 1); + d.carcTo(R, 0, 1, p3.x, p3.y); d.lineTo(p4.x, p4.y); - d.carcTo(r, p1.x, p1.y); + d.carcTo(r, 0, 0, p1.x, p1.y); d.close(); } }); diff --git a/demo/ringpalette/ringpalette.js b/demo/ringpalette/ringpalette.js index 8f4cca9..f17ac29 100644 --- a/demo/ringpalette/ringpalette.js +++ b/demo/ringpalette/ringpalette.js @@ -6,8 +6,8 @@ define(function(require, exports, module) { var Text = require('graphic/text'); var Pen = require('graphic/pen'); var Matrix = require('graphic/matrix'); - var Pie = require('../public/pie'); - var Draggable = require('../public/draggable'); + var Pie = require('../demo/ringpalette/pie'); + var Draggable = require('../demo/public/draggable'); return require('core/class').createClass({ base: Group, @@ -41,7 +41,7 @@ define(function(require, exports, module) { for (var trackNumber = 0; trackNumber < this.trackCount; trackNumber++) { this.pies.addShapes(this.generateTrackPies(trackNumber)); } - this.addShape(this.pies.rotate(-this.angleStep / 2)); + this.addShape(this.pies.rotate(0)); }, generateTrackPies: function(trackNumber) { var trackInnerRadius = this.innerRadius + this.trackHeight * trackNumber, @@ -68,8 +68,8 @@ define(function(require, exports, module) { }, generateLabels: function() { var fontSize = this.innerRadius / 6; - this.rgbLabel = new Text().setTextAnchor('center').setSize(fontSize).setY(-this.innerRadius / 8); - this.hslLabel = new Text().setTextAnchor('center').setSize(fontSize).setY(this.innerRadius / 4); + this.rgbLabel = new Text().setTextAnchor('middle').setSize(fontSize).setY(-this.innerRadius / 8); + this.hslLabel = new Text().setTextAnchor('middle').setSize(fontSize).setY(this.innerRadius / 4); this.addShape(this.rgbLabel); this.addShape(this.hslLabel); }, @@ -80,7 +80,7 @@ define(function(require, exports, module) { if (pie instanceof Pie) { var color = pie.color; - pie.scale(2); + pie.setScale(2).setTranslate(-pie.center.x, -pie.center.y); pie.stroke('white'); ring.setCircleColor(color); @@ -92,7 +92,7 @@ define(function(require, exports, module) { this.on('mouseout', function(e) { var pie = e.targetShape; if (pie instanceof Pie) { - pie.resetTransform(); + pie.setScale(1).setTranslate(0, 0); pie.stroke('none'); ring.showSelected(); } @@ -164,7 +164,7 @@ define(function(require, exports, module) { }); }, updatePosition: function(x) { - this.setTransform(new Matrix().translate(x, 0)); + this.setTranslate(x, 0); } }); }); \ No newline at end of file diff --git a/demo/shapes.html b/demo/shapes.html deleted file mode 100644 index 4d0d7f7..0000000 --- a/demo/shapes.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/demo/texteditor.html b/demo/texteditor.html index ada2b15..7a8b7af 100644 --- a/demo/texteditor.html +++ b/demo/texteditor.html @@ -1,23 +1,35 @@ - texteditor - + + - - - + + + + + + + + 模拟光标 + + + + + - - - + - - - - - \ No newline at end of file diff --git a/demo/viewport.html b/demo/viewport.html index c09247d..b089ba9 100644 --- a/demo/viewport.html +++ b/demo/viewport.html @@ -1,14 +1,28 @@ - + - Viewport - + + + + + + + + + + + 拖动和视野控制 + + + + + - - + + \ No newline at end of file diff --git a/dev-lib/cmd-define.js b/dev-lib/cmd-define.js deleted file mode 100644 index 362de2a..0000000 --- a/dev-lib/cmd-define.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * cmd 内部定义 - */ - -// 模块存储 -var _modules = {}; - -function define ( id, deps, factory ) { - - _modules[ id ] = { - - exports: {}, - value: null, - factory: null - - }; - - if ( arguments.length === 2 ) { - - factory = deps; - - } - - if ( _modules.toString.call( factory ) === '[object Object]' ) { - - _modules[ id ][ 'value' ] = factory; - - } else if ( typeof factory === 'function' ) { - - _modules[ id ][ 'factory' ] = factory; - - } else { - - throw new Error( 'define函数未定义的行为' ); - - } - -} - -function require ( id ) { - - var module = _modules[ id ], - exports = null; - - if ( !module ) { - - return null; - - } - - if ( module.value ) { - - return module.value; - - } - - - exports = module.factory.call( null, require, module.exports, module ); - - // return 值不为空, 则以return值为最终值 - if ( exports ) { - - module.exports = exports; - - } - - module.value = module.exports; - - return module.value; - -} - -function use ( id ) { - - return require( id ); - -} \ No newline at end of file diff --git a/dev-lib/dev-define.js b/dev-lib/dev-define.js index ffac355..40f46ad 100644 --- a/dev-lib/dev-define.js +++ b/dev-lib/dev-define.js @@ -31,6 +31,8 @@ }; + global.use = global.inc.use; + global.define = function(id, deps, f) { var argLen = arguments.length, @@ -148,7 +150,7 @@ loaded[key] = true; - document.write(''); } diff --git a/dev-lib/dev-start.js b/dev-lib/dev-start.js deleted file mode 100644 index b9b9db4..0000000 --- a/dev-lib/dev-start.js +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Created by hn on 13-12-4. - */ -// 启动脚本 -inc.use( 'kity.start' ); \ No newline at end of file diff --git a/dev-lib/exports.js b/dev-lib/exports.js index f0c7978..d31d5c3 100644 --- a/dev-lib/exports.js +++ b/dev-lib/exports.js @@ -3,13 +3,4 @@ /** * 模块暴露 */ - -(function() { - - try { - inc.use('kity'); - } catch (e) { - use('kity'); - } - -})(); \ No newline at end of file +use('kity'); diff --git a/dev-lib/sea-debug.js b/dev-lib/sea-debug.js deleted file mode 100644 index b62cd7d..0000000 --- a/dev-lib/sea-debug.js +++ /dev/null @@ -1,918 +0,0 @@ -/** - * Sea.js 2.1.1 | seajs.org/LICENSE.md - */ -(function(global, undefined) { - -// Avoid conflicting when `sea.js` is loaded multiple times -if (global.seajs) { - return -} - -var seajs = global.seajs = { - // The current version of Sea.js being used - version: "2.1.1" -} - -var data = seajs.data = {} - -/** - * util-lang.js - The minimal language enhancement - */ - -function isType(type) { - return function(obj) { - return Object.prototype.toString.call(obj) === "[object " + type + "]" - } -} - -var isObject = isType("Object") -var isString = isType("String") -var isArray = Array.isArray || isType("Array") -var isFunction = isType("Function") - -var _cid = 0 -function cid() { - return _cid++ -} - - -/** - * util-events.js - The minimal events support - */ - -var events = data.events = {} - -// Bind event -seajs.on = function(name, callback) { - var list = events[name] || (events[name] = []) - list.push(callback) - return seajs -} - -// Remove event. If `callback` is undefined, remove all callbacks for the -// event. If `event` and `callback` are both undefined, remove all callbacks -// for all events -seajs.off = function(name, callback) { - // Remove *all* events - if (!(name || callback)) { - events = data.events = {} - return seajs - } - - var list = events[name] - if (list) { - if (callback) { - for (var i = list.length - 1; i >= 0; i--) { - if (list[i] === callback) { - list.splice(i, 1) - } - } - } - else { - delete events[name] - } - } - - return seajs -} - -// Emit event, firing all bound callbacks. Callbacks receive the same -// arguments as `emit` does, apart from the event name -var emit = seajs.emit = function(name, data) { - var list = events[name], fn - - if (list) { - // Copy callback lists to prevent modification - list = list.slice() - - // Execute event callbacks - while ((fn = list.shift())) { - fn(data) - } - } - - return seajs -} - - -/** - * util-path.js - The utilities for operating path such as id, uri - */ - -var DIRNAME_RE = /[^?#]*\// - -var DOT_RE = /\/\.\//g -var DOUBLE_DOT_RE = /\/[^/]+\/\.\.\// - -// Extract the directory portion of a path -// dirname("a/b/c.js?t=123#xx/zz") ==> "a/b/" -// ref: http://jsperf.com/regex-vs-split/2 -function dirname(path) { - return path.match(DIRNAME_RE)[0] -} - -// Canonicalize a path -// realpath("http://test.com/a//./b/../c") ==> "http://test.com/a/c" -function realpath(path) { - // /a/b/./c/./d ==> /a/b/c/d - path = path.replace(DOT_RE, "/") - - // a/b/c/../../d ==> a/b/../d ==> a/d - while (path.match(DOUBLE_DOT_RE)) { - path = path.replace(DOUBLE_DOT_RE, "/") - } - - return path -} - -// Normalize an id -// normalize("path/to/a") ==> "path/to/a.js" -// NOTICE: substring is faster than negative slice and RegExp -function normalize(path) { - var last = path.length - 1 - var lastC = path.charAt(last) - - // If the uri ends with `#`, just return it without '#' - if (lastC === "#") { - return path.substring(0, last) - } - - return (path.substring(last - 2) === ".js" || - path.indexOf("?") > 0 || - path.substring(last - 3) === ".css" || - lastC === "/") ? path : path + ".js" -} - - -var PATHS_RE = /^([^/:]+)(\/.+)$/ -var VARS_RE = /{([^{]+)}/g - -function parseAlias(id) { - var alias = data.alias - return alias && isString(alias[id]) ? alias[id] : id -} - -function parsePaths(id) { - var paths = data.paths - var m - - if (paths && (m = id.match(PATHS_RE)) && isString(paths[m[1]])) { - id = paths[m[1]] + m[2] - } - - return id -} - -function parseVars(id) { - var vars = data.vars - - if (vars && id.indexOf("{") > -1) { - id = id.replace(VARS_RE, function(m, key) { - return isString(vars[key]) ? vars[key] : m - }) - } - - return id -} - -function parseMap(uri) { - var map = data.map - var ret = uri - - if (map) { - for (var i = 0, len = map.length; i < len; i++) { - var rule = map[i] - - ret = isFunction(rule) ? - (rule(uri) || uri) : - uri.replace(rule[0], rule[1]) - - // Only apply the first matched rule - if (ret !== uri) break - } - } - - return ret -} - - -var ABSOLUTE_RE = /^\/\/.|:\// -var ROOT_DIR_RE = /^.*?\/\/.*?\// - -function addBase(id, refUri) { - var ret - var first = id.charAt(0) - - // Absolute - if (ABSOLUTE_RE.test(id)) { - ret = id - } - // Relative - else if (first === ".") { - ret = realpath((refUri ? dirname(refUri) : data.cwd) + id) - } - // Root - else if (first === "/") { - var m = data.cwd.match(ROOT_DIR_RE) - ret = m ? m[0] + id.substring(1) : id - } - // Top-level - else { - ret = data.base + id - } - - return ret -} - -function id2Uri(id, refUri) { - if (!id) return "" - - id = parseAlias(id) - id = parsePaths(id) - id = parseVars(id) - id = normalize(id) - - var uri = addBase(id, refUri) - uri = parseMap(uri) - - return uri -} - - -var doc = document -var loc = location -var cwd = dirname(loc.href) -var scripts = doc.getElementsByTagName("script") - -// Recommend to add `seajsnode` id for the `sea.js` script element -var loaderScript = doc.getElementById("seajsnode") || - scripts[scripts.length - 1] - -// When `sea.js` is inline, set loaderDir to current working directory -var loaderDir = dirname(getScriptAbsoluteSrc(loaderScript) || cwd) - -function getScriptAbsoluteSrc(node) { - return node.hasAttribute ? // non-IE6/7 - node.src : - // see http://msdn.microsoft.com/en-us/library/ms536429(VS.85).aspx - node.getAttribute("src", 4) -} - - -/** - * util-request.js - The utilities for requesting script and style files - * ref: tests/research/load-js-css/test.html - */ - -var head = doc.getElementsByTagName("head")[0] || doc.documentElement -var baseElement = head.getElementsByTagName("base")[0] - -var IS_CSS_RE = /\.css(?:\?|$)/i -var READY_STATE_RE = /^(?:loaded|complete|undefined)$/ - -var currentlyAddingScript -var interactiveScript - -// `onload` event is not supported in WebKit < 535.23 and Firefox < 9.0 -// ref: -// - https://bugs.webkit.org/show_activity.cgi?id=38995 -// - https://bugzilla.mozilla.org/show_bug.cgi?id=185236 -// - https://developer.mozilla.org/en/HTML/Element/link#Stylesheet_load_events -var isOldWebKit = (navigator.userAgent - .replace(/.*AppleWebKit\/(\d+)\..*/, "$1")) * 1 < 536 - - -function request(url, callback, charset) { - var isCSS = IS_CSS_RE.test(url) - var node = doc.createElement(isCSS ? "link" : "script") - - if (charset) { - var cs = isFunction(charset) ? charset(url) : charset - if (cs) { - node.charset = cs - } - } - - addOnload(node, callback, isCSS) - - if (isCSS) { - node.rel = "stylesheet" - node.href = url - } - else { - node.async = true - node.src = url - } - - // For some cache cases in IE 6-8, the script executes IMMEDIATELY after - // the end of the insert execution, so use `currentlyAddingScript` to - // hold current node, for deriving url in `define` call - currentlyAddingScript = node - - // ref: #185 & http://dev.jquery.com/ticket/2709 - baseElement ? - head.insertBefore(node, baseElement) : - head.appendChild(node) - - currentlyAddingScript = null -} - -function addOnload(node, callback, isCSS) { - var missingOnload = isCSS && (isOldWebKit || !("onload" in node)) - - // for Old WebKit and Old Firefox - if (missingOnload) { - setTimeout(function() { - pollCss(node, callback) - }, 1) // Begin after node insertion - return - } - - node.onload = node.onerror = node.onreadystatechange = function() { - if (READY_STATE_RE.test(node.readyState)) { - - // Ensure only run once and handle memory leak in IE - node.onload = node.onerror = node.onreadystatechange = null - - // Remove the script to reduce memory leak - if (!isCSS && !data.debug) { - head.removeChild(node) - } - - // Dereference the node - node = null - - callback() - } - } -} - -function pollCss(node, callback) { - var sheet = node.sheet - var isLoaded - - // for WebKit < 536 - if (isOldWebKit) { - if (sheet) { - isLoaded = true - } - } - // for Firefox < 9.0 - else if (sheet) { - try { - if (sheet.cssRules) { - isLoaded = true - } - } catch (ex) { - // The value of `ex.name` is changed from "NS_ERROR_DOM_SECURITY_ERR" - // to "SecurityError" since Firefox 13.0. But Firefox is less than 9.0 - // in here, So it is ok to just rely on "NS_ERROR_DOM_SECURITY_ERR" - if (ex.name === "NS_ERROR_DOM_SECURITY_ERR") { - isLoaded = true - } - } - } - - setTimeout(function() { - if (isLoaded) { - // Place callback here to give time for style rendering - callback() - } - else { - pollCss(node, callback) - } - }, 20) -} - -function getCurrentScript() { - if (currentlyAddingScript) { - return currentlyAddingScript - } - - // For IE6-9 browsers, the script onload event may not fire right - // after the script is evaluated. Kris Zyp found that it - // could query the script nodes and the one that is in "interactive" - // mode indicates the current script - // ref: http://goo.gl/JHfFW - if (interactiveScript && interactiveScript.readyState === "interactive") { - return interactiveScript - } - - var scripts = head.getElementsByTagName("script") - - for (var i = scripts.length - 1; i >= 0; i--) { - var script = scripts[i] - if (script.readyState === "interactive") { - interactiveScript = script - return interactiveScript - } - } -} - - -/** - * util-deps.js - The parser for dependencies - * ref: tests/research/parse-dependencies/test.html - */ - -var REQUIRE_RE = /"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g -var SLASH_RE = /\\\\/g - -function parseDependencies(code) { - var ret = [] - - code.replace(SLASH_RE, "") - .replace(REQUIRE_RE, function(m, m1, m2) { - if (m2) { - ret.push(m2) - } - }) - - return ret -} - - -/** - * module.js - The core of module loader - */ - -var cachedMods = seajs.cache = {} -var anonymousMeta - -var fetchingList = {} -var fetchedList = {} -var callbackList = {} - -var STATUS = Module.STATUS = { - // 1 - The `module.uri` is being fetched - FETCHING: 1, - // 2 - The meta data has been saved to cachedMods - SAVED: 2, - // 3 - The `module.dependencies` are being loaded - LOADING: 3, - // 4 - The module are ready to execute - LOADED: 4, - // 5 - The module is being executed - EXECUTING: 5, - // 6 - The `module.exports` is available - EXECUTED: 6 -} - - -function Module(uri, deps) { - this.uri = uri - this.dependencies = deps || [] - this.exports = null - this.status = 0 - - // Who depends on me - this._waitings = {} - - // The number of unloaded dependencies - this._remain = 0 -} - -// Resolve module.dependencies -Module.prototype.resolve = function() { - var mod = this - var ids = mod.dependencies - var uris = [] - - for (var i = 0, len = ids.length; i < len; i++) { - uris[i] = Module.resolve(ids[i], mod.uri) - } - return uris -} - -// Load module.dependencies and fire onload when all done -Module.prototype.load = function() { - var mod = this - - // If the module is being loaded, just wait it onload call - if (mod.status >= STATUS.LOADING) { - return - } - - mod.status = STATUS.LOADING - - // Emit `load` event for plugins such as combo plugin - var uris = mod.resolve() - emit("load", uris) - - var len = mod._remain = uris.length - var m - - // Initialize modules and register waitings - for (var i = 0; i < len; i++) { - m = Module.get(uris[i]) - - if (m.status < STATUS.LOADED) { - // Maybe duplicate - m._waitings[mod.uri] = (m._waitings[mod.uri] || 0) + 1 - } - else { - mod._remain-- - } - } - - if (mod._remain === 0) { - mod.onload() - return - } - - // Begin parallel loading - var requestCache = {} - - for (i = 0; i < len; i++) { - m = cachedMods[uris[i]] - - if (m.status < STATUS.FETCHING) { - m.fetch(requestCache) - } - else if (m.status === STATUS.SAVED) { - m.load() - } - } - - // Send all requests at last to avoid cache bug in IE6-9. Issues#808 - for (var requestUri in requestCache) { - if (requestCache.hasOwnProperty(requestUri)) { - requestCache[requestUri]() - } - } -} - -// Call this method when module is loaded -Module.prototype.onload = function() { - var mod = this - mod.status = STATUS.LOADED - - if (mod.callback) { - mod.callback() - } - - // Notify waiting modules to fire onload - var waitings = mod._waitings - var uri, m - - for (uri in waitings) { - if (waitings.hasOwnProperty(uri)) { - m = cachedMods[uri] - m._remain -= waitings[uri] - if (m._remain === 0) { - m.onload() - } - } - } - - // Reduce memory taken - delete mod._waitings - delete mod._remain -} - -// Fetch a module -Module.prototype.fetch = function(requestCache) { - var mod = this - var uri = mod.uri - - mod.status = STATUS.FETCHING - - // Emit `fetch` event for plugins such as combo plugin - var emitData = { uri: uri } - emit("fetch", emitData) - var requestUri = emitData.requestUri || uri - - // Empty uri or a non-CMD module - if (!requestUri || fetchedList[requestUri]) { - mod.load() - return - } - - if (fetchingList[requestUri]) { - callbackList[requestUri].push(mod) - return - } - - fetchingList[requestUri] = true - callbackList[requestUri] = [mod] - - // Emit `request` event for plugins such as text plugin - emit("request", emitData = { - uri: uri, - requestUri: requestUri, - onRequest: onRequest, - charset: data.charset - }) - - if (!emitData.requested) { - requestCache ? - requestCache[emitData.requestUri] = sendRequest : - sendRequest() - } - - function sendRequest() { - request(emitData.requestUri, emitData.onRequest, emitData.charset) - } - - function onRequest() { - delete fetchingList[requestUri] - fetchedList[requestUri] = true - - // Save meta data of anonymous module - if (anonymousMeta) { - Module.save(uri, anonymousMeta) - anonymousMeta = null - } - - // Call callbacks - var m, mods = callbackList[requestUri] - delete callbackList[requestUri] - while ((m = mods.shift())) m.load() - } -} - -// Execute a module -Module.prototype.exec = function () { - var mod = this - - // When module is executed, DO NOT execute it again. When module - // is being executed, just return `module.exports` too, for avoiding - // circularly calling - if (mod.status >= STATUS.EXECUTING) { - return mod.exports - } - - mod.status = STATUS.EXECUTING - - // Create require - var uri = mod.uri - - function require(id) { - return Module.get(require.resolve(id)).exec() - } - - require.resolve = function(id) { - return Module.resolve(id, uri) - } - - require.async = function(ids, callback) { - Module.use(ids, callback, uri + "_async_" + cid()) - return require - } - - // Exec factory - var factory = mod.factory - - var exports = isFunction(factory) ? - factory(require, mod.exports = {}, mod) : - factory - - if (exports === undefined) { - exports = mod.exports - } - - // Emit `error` event - if (exports === null && !IS_CSS_RE.test(uri)) { - emit("error", mod) - } - - // Reduce memory leak - delete mod.factory - - mod.exports = exports - mod.status = STATUS.EXECUTED - - // Emit `exec` event - emit("exec", mod) - - return exports -} - -// Resolve id to uri -Module.resolve = function(id, refUri) { - // Emit `resolve` event for plugins such as text plugin - var emitData = { id: id, refUri: refUri } - emit("resolve", emitData) - - return emitData.uri || id2Uri(emitData.id, refUri) -} - -// Define a module -Module.define = function (id, deps, factory) { - var argsLen = arguments.length - - // define(factory) - if (argsLen === 1) { - factory = id - id = undefined - } - else if (argsLen === 2) { - factory = deps - - // define(deps, factory) - if (isArray(id)) { - deps = id - id = undefined - } - // define(id, factory) - else { - deps = undefined - } - } - - // Parse dependencies according to the module factory code - if (!isArray(deps) && isFunction(factory)) { - deps = parseDependencies(factory.toString()) - } - - var meta = { - id: id, - uri: Module.resolve(id), - deps: deps, - factory: factory - } - - // Try to derive uri in IE6-9 for anonymous modules - if (!meta.uri && doc.attachEvent) { - var script = getCurrentScript() - - if (script) { - meta.uri = script.src - } - - // NOTE: If the id-deriving methods above is failed, then falls back - // to use onload event to get the uri - } - - // Emit `define` event, used in nocache plugin, seajs node version etc - emit("define", meta) - - meta.uri ? Module.save(meta.uri, meta) : - // Save information for "saving" work in the script onload event - anonymousMeta = meta -} - -// Save meta data to cachedMods -Module.save = function(uri, meta) { - var mod = Module.get(uri) - - // Do NOT override already saved modules - if (mod.status < STATUS.SAVED) { - mod.id = meta.id || uri - mod.dependencies = meta.deps || [] - mod.factory = meta.factory - mod.status = STATUS.SAVED - } -} - -// Get an existed module or create a new one -Module.get = function(uri, deps) { - return cachedMods[uri] || (cachedMods[uri] = new Module(uri, deps)) -} - -// Use function is equal to load a anonymous module -Module.use = function (ids, callback, uri) { - var mod = Module.get(uri, isArray(ids) ? ids : [ids]) - - mod.callback = function() { - var exports = [] - var uris = mod.resolve() - - for (var i = 0, len = uris.length; i < len; i++) { - exports[i] = cachedMods[uris[i]].exec() - } - - if (callback) { - callback.apply(global, exports) - } - - delete mod.callback - } - - mod.load() -} - -// Load preload modules before all other modules -Module.preload = function(callback) { - var preloadMods = data.preload - var len = preloadMods.length - - if (len) { - Module.use(preloadMods, function() { - // Remove the loaded preload modules - preloadMods.splice(0, len) - - // Allow preload modules to add new preload modules - Module.preload(callback) - }, data.cwd + "_preload_" + cid()) - } - else { - callback() - } -} - - -// Public API - -seajs.use = function(ids, callback) { - Module.preload(function() { - Module.use(ids, callback, data.cwd + "_use_" + cid()) - }) - return seajs -} - -Module.define.cmd = {} -global.define = Module.define - - -// For Developers - -seajs.Module = Module -data.fetchedList = fetchedList -data.cid = cid - -seajs.resolve = id2Uri -seajs.require = function(id) { - return (cachedMods[Module.resolve(id)] || {}).exports -} - - -/** - * config.js - The configuration for the loader - */ - -var BASE_RE = /^(.+?\/)(\?\?)?(seajs\/)+/ - -// The root path to use for id2uri parsing -// If loaderUri is `http://test.com/libs/seajs/[??][seajs/1.2.3/]sea.js`, the -// baseUri should be `http://test.com/libs/` -data.base = (loaderDir.match(BASE_RE) || ["", loaderDir])[1] - -// The loader directory -data.dir = loaderDir - -// The current working directory -data.cwd = cwd - -// The charset for requesting files -data.charset = "utf-8" - -// Modules that are needed to load before all other modules -data.preload = (function() { - var plugins = [] - - // Convert `seajs-xxx` to `seajs-xxx=1` - // NOTE: use `seajs-xxx=1` flag in uri or cookie to preload `seajs-xxx` - var str = loc.search.replace(/(seajs-\w+)(&|$)/g, "$1=1$2") - - // Add cookie string - str += " " + doc.cookie - - // Exclude seajs-xxx=0 - str.replace(/(seajs-\w+)=1/g, function(m, name) { - plugins.push(name) - }) - - return plugins -})() - -// data.alias - An object containing shorthands of module id -// data.paths - An object containing path shorthands in module id -// data.vars - The {xxx} variables in module id -// data.map - An array containing rules to map module uri -// data.debug - Debug mode. The default value is false - -seajs.config = function(configData) { - - for (var key in configData) { - var curr = configData[key] - var prev = data[key] - - // Merge object config such as alias, vars - if (prev && isObject(prev)) { - for (var k in curr) { - prev[k] = curr[k] - } - } - else { - // Concat array config such as map, preload - if (isArray(prev)) { - curr = prev.concat(curr) - } - // Make sure that `data.base` is an absolute path - else if (key === "base") { - (curr.slice(-1) === "/") || (curr += "/") - curr = addBase(curr) - } - - // Set config - data[key] = curr - } - } - - emit("config", configData) - return seajs -} - - -})(this); diff --git a/dev-lib/sea.js b/dev-lib/sea.js deleted file mode 100644 index 2cf3bb1..0000000 --- a/dev-lib/sea.js +++ /dev/null @@ -1,15 +0,0 @@ -/*! Sea.js 2.1.1 | seajs.org/LICENSE.md -//# sourceMappingURL=sea.js.map -*/(function(t,u){function v(b){return function(c){return Object.prototype.toString.call(c)==="[object "+b+"]"}}function Q(){return w++}function I(b,c){var a;a=b.charAt(0);if(R.test(b))a=b;else if("."===a){a=(c?c.match(E)[0]:h.cwd)+b;for(a=a.replace(S,"/");a.match(J);)a=a.replace(J,"/")}else a="/"===a?(a=h.cwd.match(T))?a[0]+b.substring(1):b:h.base+b;return a}function K(b,c){if(!b)return"";var a=b,d=h.alias,a=b=d&&F(d[a])?d[a]:a,d=h.paths,g;if(d&&(g=a.match(U))&&F(d[g[1]]))a=d[g[1]]+g[2];g=a;var e=h.vars; -e&&-11*navigator.userAgent.replace(/.*AppleWebKit\/(\d+)\..*/,"$1"),Z=/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g,$=/\\\\/g,r=f.cache={},C,G={},H={},D={},j=e.STATUS={FETCHING:1, -SAVED:2,LOADING:3,LOADED:4,EXECUTING:5,EXECUTED:6};e.prototype.resolve=function(){for(var b=this.dependencies,c=[],a=0,d=b.length;a=j.LOADING)){this.status=j.LOADING;var b=this.resolve();m("load",b);for(var c=this._remain=b.length,a,d=0;d=j.EXECUTING)return this.exports;this.status=j.EXECUTING;var c=this.uri;b.resolve=function(a){return e.resolve(a,c)};b.async=function(a,g){e.use(a,g,c+"_async_"+w++);return b};var a=this.factory,a= -x(a)?a(b,this.exports={},this):a;a===u&&(a=this.exports);null===a&&!O.test(c)&&m("error",this);delete this.factory;this.exports=a;this.status=j.EXECUTED;m("exec",this);return a};e.resolve=function(b,c){var a={id:b,refUri:c};m("resolve",a);return a.uri||K(a.id,c)};e.define=function(b,c,a){var d=arguments.length;1===d?(a=b,b=u):2===d&&(a=c,A(b)?(c=b,b=u):c=u);if(!A(c)&&x(a)){var g=[];a.toString().replace($,"").replace(Z,function(a,b,c){c&&g.push(c)});c=g}d={id:b,uri:e.resolve(b),deps:c,factory:a};if(!d.uri&& -n.attachEvent){var f=W();f&&(d.uri=f.src)}m("define",d);d.uri?e.save(d.uri,d):C=d};e.save=function(b,c){var a=e.get(b);a.status 0) { - setTimeout(function() { + start: function(target, duration, easing, delay, callback) { + if (arguments.length === 2 && typeof duration == "object") { + easing = duration.easing; + delay = duration.delay; + callback = duration.callback; + duration = duration.duration; + } + if (arguments.length === 4 && typeof delay == "function") { + callback = delay; + delay = 0; + } + var timeline = this.create(target, duration, easing, callback); + delay = parseTime(delay); + if (delay > 0) { + setTimeout(function() { + timeline.play(); + }, delay); + } else { timeline.play(); - }, delay); - } else { - timeline.play(); - } - return timeline; - }, - /** + } + return timeline; + }, + /** * @method create() * @for kity.Animator * @description 使用当前的动画器为指定目标创建时间线 @@ -235,20 +189,20 @@ define("animate/animator", [ "animate/timeline", "graphic/eventhandler", "animat * timeline.repeat(3).play(); * ``` */ - create: function(target, duration, easing, callback) { - var timeline; - duration = duration && parseTime(duration) || Animator.DEFAULT_DURATION; - easing = easing || Animator.DEFAULT_EASING; - if (typeof easing == "string") { - easing = easingTable[easing]; - } - timeline = new Timeline(this, target, duration, easing); - if (typeof callback == "function") { - timeline.on("finish", callback); - } - return timeline; - }, - /** + create: function(target, duration, easing, callback) { + var timeline; + duration = duration && parseTime(duration) || Animator.DEFAULT_DURATION; + easing = easing || Animator.DEFAULT_EASING; + if (typeof easing == "string") { + easing = easingTable[easing]; + } + timeline = new Timeline(this, target, duration, easing); + if (typeof callback == "function") { + timeline.on("finish", callback); + } + return timeline; + }, + /** * @method reverse() * @for kity.Animator * @grammar reverse() => {kity.Animator} @@ -260,15 +214,15 @@ define("animate/animator", [ "animate/timeline", "graphic/eventhandler", "animat * var turnYellow = turnRed.reverse(); * ``` */ - reverse: function() { - return new Animator(this.finishValue, this.beginValue, this.setter); - } - }); - Animator.DEFAULT_DURATION = 300; - Animator.DEFAULT_EASING = "linear"; - var Shape = require("graphic/shape"); - require("core/class").extendClass(Shape, { - /** + reverse: function() { + return new Animator(this.finishValue, this.beginValue, this.setter); + } + }); + Animator.DEFAULT_DURATION = 300; + Animator.DEFAULT_EASING = "linear"; + var Shape = _p.r(61); + _p.r(11).extendClass(Shape, { + /** * @method animate() * @for kity.Shape * @description 在图形上播放使用指定的动画器播放动画,如果图形当前有动画正在播放,则会加入播放队列 @@ -288,26 +242,26 @@ define("animate/animator", [ "animate/timeline", "graphic/eventhandler", "animat * rect.animate(expand, 500); // turnRect 播放结束后播放 expand * ``` */ - animate: function(animator, duration, easing, delay, callback) { - var queue = this._KityAnimateQueue = this._KityAnimateQueue || []; - var timeline = animator.create(this, duration, easing, callback); - function dequeue() { - queue.shift(); - if (queue.length) { - setTimeout(queue[0].t.play.bind(queue[0].t), queue[0].d); - } - } - timeline.on("finish", dequeue); - queue.push({ - t: timeline, - d: delay - }); - if (queue.length == 1) { - setTimeout(timeline.play.bind(timeline), delay); - } - return this; - }, - /** + animate: function(animator, duration, easing, delay, callback) { + var queue = this._KityAnimateQueue = this._KityAnimateQueue || []; + var timeline = animator.create(this, duration, easing, callback); + function dequeue() { + queue.shift(); + if (queue.length) { + setTimeout(queue[0].t.play.bind(queue[0].t), queue[0].d); + } + } + timeline.on("finish", dequeue); + queue.push({ + t: timeline, + d: delay + }); + if (queue.length == 1) { + setTimeout(timeline.play.bind(timeline), delay); + } + return this; + }, + /** * @method timeline() * @for kity.Shape * @description 获得当前正在播放的动画的时间线 @@ -320,10 +274,10 @@ define("animate/animator", [ "animate/timeline", "graphic/eventhandler", "animat * rect.timeline().repeat(2); * ``` */ - timeline: function() { - return this._KityAnimateQueue[0].t; - }, - /** + timeline: function() { + return this._KityAnimateQueue[0].t; + }, + /** * @method stop() * @for kity.Shape * @description 停止当前正在播放的动画 @@ -336,18 +290,21 @@ define("animate/animator", [ "animate/timeline", "graphic/eventhandler", "animat * rect.stop(); // 停止 rect 上的动画 * ``` */ - stop: function() { - var queue = this._KityAnimateQueue; - if (queue) { - while (queue.length) { - queue.shift().t.stop(); + stop: function() { + var queue = this._KityAnimateQueue; + if (queue) { + while (queue.length) { + queue.shift().t.stop(); + } } + return this; } - return this; - } - }); - return Animator; -}); + }); + return Animator; + } +}; + +//src/animate/easing.js /** * Kity Animate Easing modified from jQuery Easing * Author: techird @@ -364,200 +321,237 @@ define("animate/animator", [ "animate/timeline", "graphic/eventhandler", "animat * All rights reserved. * https://raw.github.com/danro/jquery-easing/master/LICENSE * ======================================================== */ -define("animate/easing", [], function(require, exports, module) { - var easings = { - // t: current_time, b: begin_value, c: change_value, d: duration - linear: function(t, b, c, d) { - return c * (t / d) + b; - }, - swing: function(t, b, c, d) { - return easings.easeOutQuad(t, b, c, d); - }, - ease: function(t, b, c, d) { - return easings.easeInOutCubic(t, b, c, d); - }, - easeInQuad: function(t, b, c, d) { - return c * (t /= d) * t + b; - }, - easeOutQuad: function(t, b, c, d) { - return -c * (t /= d) * (t - 2) + b; - }, - easeInOutQuad: function(t, b, c, d) { - if ((t /= d / 2) < 1) return c / 2 * t * t + b; - return -c / 2 * (--t * (t - 2) - 1) + b; - }, - easeInCubic: function(t, b, c, d) { - return c * (t /= d) * t * t + b; - }, - easeOutCubic: function(t, b, c, d) { - return c * ((t = t / d - 1) * t * t + 1) + b; - }, - easeInOutCubic: function(t, b, c, d) { - if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; - return c / 2 * ((t -= 2) * t * t + 2) + b; - }, - easeInQuart: function(t, b, c, d) { - return c * (t /= d) * t * t * t + b; - }, - easeOutQuart: function(t, b, c, d) { - return -c * ((t = t / d - 1) * t * t * t - 1) + b; - }, - easeInOutQuart: function(t, b, c, d) { - if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b; - return -c / 2 * ((t -= 2) * t * t * t - 2) + b; - }, - easeInQuint: function(t, b, c, d) { - return c * (t /= d) * t * t * t * t + b; - }, - easeOutQuint: function(t, b, c, d) { - return c * ((t = t / d - 1) * t * t * t * t + 1) + b; - }, - easeInOutQuint: function(t, b, c, d) { - if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b; - return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; - }, - easeInSine: function(t, b, c, d) { - return -c * Math.cos(t / d * (Math.PI / 2)) + c + b; - }, - easeOutSine: function(t, b, c, d) { - return c * Math.sin(t / d * (Math.PI / 2)) + b; - }, - easeInOutSine: function(t, b, c, d) { - return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; - }, - easeInExpo: function(t, b, c, d) { - return t === 0 ? b : c * Math.pow(2, 10 * (t / d - 1)) + b; - }, - easeOutExpo: function(t, b, c, d) { - return t == d ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; - }, - easeInOutExpo: function(t, b, c, d) { - if (t === 0) return b; - if (t == d) return b + c; - if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b; - return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; - }, - easeInCirc: function(t, b, c, d) { - return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; - }, - easeOutCirc: function(t, b, c, d) { - return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; - }, - easeInOutCirc: function(t, b, c, d) { - if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; - return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; - }, - easeInElastic: function(t, b, c, d) { - var s = 1.70158; - var p = 0; - var a = c; - if (t === 0) return b; - if ((t /= d) == 1) return b + c; - if (!p) p = d * .3; - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else s = p / (2 * Math.PI) * Math.asin(c / a); - return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * 2 * Math.PI / p)) + b; - }, - easeOutElastic: function(t, b, c, d) { - var s = 1.70158; - var p = 0; - var a = c; - if (t === 0) return b; - if ((t /= d) == 1) return b + c; - if (!p) p = d * .3; - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else s = p / (2 * Math.PI) * Math.asin(c / a); - return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * 2 * Math.PI / p) + c + b; - }, - easeInOutElastic: function(t, b, c, d) { - var s = 1.70158; - var p = 0; - var a = c; - if (t === 0) return b; - if ((t /= d / 2) == 2) return b + c; - if (!p) p = d * .3 * 1.5; - if (a < Math.abs(c)) { - a = c; - var s = p / 4; - } else var s = p / (2 * Math.PI) * Math.asin(c / a); - if (t < 1) return -.5 * a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * 2 * Math.PI / p) + b; - return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * 2 * Math.PI / p) * .5 + c + b; - }, - easeInBack: function(t, b, c, d, s) { - if (s == undefined) s = 1.70158; - return c * (t /= d) * t * ((s + 1) * t - s) + b; - }, - easeOutBack: function(t, b, c, d, s) { - if (s == undefined) s = 1.70158; - return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; - }, - easeInOutBack: function(t, b, c, d, s) { - if (s == undefined) s = 1.70158; - if ((t /= d / 2) < 1) return c / 2 * t * t * (((s *= 1.525) + 1) * t - s) + b; - return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b; - }, - easeInBounce: function(t, b, c, d) { - return c - easings.easeOutBounce(d - t, 0, c, d) + b; - }, - easeOutBounce: function(t, b, c, d) { - if ((t /= d) < 1 / 2.75) { - return c * 7.5625 * t * t + b; - } else if (t < 2 / 2.75) { - return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b; - } else if (t < 2.5 / 2.75) { - return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b; - } else { - return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b; +_p[1] = { + value: function(require, exports, module) { + var easings = { + // t: current_time, b: begin_value, c: change_value, d: duration + linear: function(t, b, c, d) { + return c * (t / d) + b; + }, + swing: function(t, b, c, d) { + return easings.easeOutQuad(t, b, c, d); + }, + ease: function(t, b, c, d) { + return easings.easeInOutCubic(t, b, c, d); + }, + easeInQuad: function(t, b, c, d) { + return c * (t /= d) * t + b; + }, + easeOutQuad: function(t, b, c, d) { + return -c * (t /= d) * (t - 2) + b; + }, + easeInOutQuad: function(t, b, c, d) { + if ((t /= d / 2) < 1) return c / 2 * t * t + b; + return -c / 2 * (--t * (t - 2) - 1) + b; + }, + easeInCubic: function(t, b, c, d) { + return c * (t /= d) * t * t + b; + }, + easeOutCubic: function(t, b, c, d) { + return c * ((t = t / d - 1) * t * t + 1) + b; + }, + easeInOutCubic: function(t, b, c, d) { + if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; + return c / 2 * ((t -= 2) * t * t + 2) + b; + }, + easeInQuart: function(t, b, c, d) { + return c * (t /= d) * t * t * t + b; + }, + easeOutQuart: function(t, b, c, d) { + return -c * ((t = t / d - 1) * t * t * t - 1) + b; + }, + easeInOutQuart: function(t, b, c, d) { + if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b; + return -c / 2 * ((t -= 2) * t * t * t - 2) + b; + }, + easeInQuint: function(t, b, c, d) { + return c * (t /= d) * t * t * t * t + b; + }, + easeOutQuint: function(t, b, c, d) { + return c * ((t = t / d - 1) * t * t * t * t + 1) + b; + }, + easeInOutQuint: function(t, b, c, d) { + if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b; + return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; + }, + easeInSine: function(t, b, c, d) { + return -c * Math.cos(t / d * (Math.PI / 2)) + c + b; + }, + easeOutSine: function(t, b, c, d) { + return c * Math.sin(t / d * (Math.PI / 2)) + b; + }, + easeInOutSine: function(t, b, c, d) { + return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; + }, + easeInExpo: function(t, b, c, d) { + return t === 0 ? b : c * Math.pow(2, 10 * (t / d - 1)) + b; + }, + easeOutExpo: function(t, b, c, d) { + return t == d ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; + }, + easeInOutExpo: function(t, b, c, d) { + if (t === 0) return b; + if (t == d) return b + c; + if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b; + return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; + }, + easeInCirc: function(t, b, c, d) { + return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; + }, + easeOutCirc: function(t, b, c, d) { + return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; + }, + easeInOutCirc: function(t, b, c, d) { + if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; + return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; + }, + easeInElastic: function(t, b, c, d) { + var s = 1.70158; + var p = 0; + var a = c; + if (t === 0) return b; + if ((t /= d) == 1) return b + c; + if (!p) p = d * .3; + if (a < Math.abs(c)) { + a = c; + s = p / 4; + } else s = p / (2 * Math.PI) * Math.asin(c / a); + return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; + }, + easeOutElastic: function(t, b, c, d) { + var s = 1.70158; + var p = 0; + var a = c; + if (t === 0) return b; + if ((t /= d) == 1) return b + c; + if (!p) p = d * .3; + if (a < Math.abs(c)) { + a = c; + s = p / 4; + } else s = p / (2 * Math.PI) * Math.asin(c / a); + return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b; + }, + easeInOutElastic: function(t, b, c, d) { + var s = 1.70158; + var p = 0; + var a = c; + if (t === 0) return b; + if ((t /= d / 2) == 2) return b + c; + if (!p) p = d * (.3 * 1.5); + if (a < Math.abs(c)) { + a = c; + var s = p / 4; + } else var s = p / (2 * Math.PI) * Math.asin(c / a); + if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; + return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; + }, + easeInBack: function(t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c * (t /= d) * t * ((s + 1) * t - s) + b; + }, + easeOutBack: function(t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; + }, + easeInOutBack: function(t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b; + return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b; + }, + easeInBounce: function(t, b, c, d) { + return c - easings.easeOutBounce(d - t, 0, c, d) + b; + }, + easeOutBounce: function(t, b, c, d) { + if ((t /= d) < 1 / 2.75) { + return c * (7.5625 * t * t) + b; + } else if (t < 2 / 2.75) { + return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b; + } else if (t < 2.5 / 2.75) { + return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b; + } else { + return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b; + } + }, + easeInOutBounce: function(t, b, c, d) { + if (t < d / 2) return easings.easeInBounce(t * 2, 0, c, d) * .5 + b; + return easings.easeOutBounce(t * 2 - d, 0, c, d) * .5 + c * .5 + b; } - }, - easeInOutBounce: function(t, b, c, d) { - if (t < d / 2) return easings.easeInBounce(t * 2, 0, c, d) * .5 + b; - return easings.easeOutBounce(t * 2 - d, 0, c, d) * .5 + c * .5 + b; - } - }; - return easings; -}); + }; + return easings; + } +}; + +/* + * + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright © 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +//src/animate/frame.js /** * @fileOverview * * 提供动画帧的基本支持 */ -define("animate/frame", [], function(require, exports) { - // 原生动画帧方法 polyfill - var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function(fn) { - return setTimeout(fn, 1e3 / 60); - }; - var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame || window.clearTimeout; - // 上一个请求的原生动画帧 id - var frameRequestId; - // 等待执行的帧动作的集合,这些帧的方法将在下个原生动画帧同步执行 - var pendingFrames = []; - /** +_p[2] = { + value: function(require, exports) { + // 原生动画帧方法 polyfill + var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function(fn) { + return setTimeout(fn, 1e3 / 60); + }; + var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame || window.clearTimeout; + // 上一个请求的原生动画帧 id + var frameRequestId; + // 等待执行的帧动作的集合,这些帧的方法将在下个原生动画帧同步执行 + var pendingFrames = []; + /** * 添加一个帧到等待集合中 * * 如果添加的帧是序列的第一个,至少有一个帧需要被执行,则会请求一个原生动画帧来执行 */ - function pushFrame(frame) { - if (pendingFrames.push(frame) === 1) { - frameRequestId = requestAnimationFrame(executePendingFrames); + function pushFrame(frame) { + if (pendingFrames.push(frame) === 1) { + frameRequestId = requestAnimationFrame(executePendingFrames); + } } - } - /** + /** * 执行所有等待帧 */ - function executePendingFrames() { - var frames = pendingFrames; - pendingFrames = []; - while (frames.length) { - executeFrame(frames.pop()); + function executePendingFrames() { + var frames = pendingFrames; + pendingFrames = []; + while (frames.length) { + executeFrame(frames.pop()); + } + frameRequestId = 0; } - frameRequestId = 0; - } - /** + /** * @method kity.requestFrame * @catalog animate * @grammar kity.requestFrame(action) => {frame} @@ -597,12 +591,12 @@ define("animate/frame", [], function(require, exports) { * }); * ``` */ - function requestFrame(action) { - var frame = initFrame(action); - pushFrame(frame); - return frame; - } - /** + function requestFrame(action) { + var frame = initFrame(action); + pushFrame(frame); + return frame; + } + /** * @method kity.releaseFrame * @catalog animate * @grammar kity.releaseFrame(frame) @@ -617,67 +611,71 @@ define("animate/frame", [], function(require, exports) { * kity.releaseFrame(frame); * ``` */ - function releaseFrame(frame) { - var index = pendingFrames.indexOf(frame); - if (~index) { - pendingFrames.splice(index, 1); - } - if (pendingFrames.length === 0) { - cancelAnimationFrame(frameRequestId); + function releaseFrame(frame) { + var index = pendingFrames.indexOf(frame); + if (~index) { + pendingFrames.splice(index, 1); + } + if (pendingFrames.length === 0) { + cancelAnimationFrame(frameRequestId); + } } - } - /** + /** * 初始化一个帧,主要用于后续计算 */ - function initFrame(action) { - var frame = { - index: 0, - time: +new Date(), - elapsed: 0, - action: action, - next: function() { - pushFrame(frame); - } - }; - return frame; - } - /** + function initFrame(action) { + var frame = { + index: 0, + time: +new Date(), + elapsed: 0, + action: action, + next: function() { + pushFrame(frame); + } + }; + return frame; + } + /** * 执行一个帧动作 */ - function executeFrame(frame) { - // 当前帧时间错 - var time = +new Date(); - // 当上一帧到当前帧经过的时间 - var dur = time - frame.time; - // - // http://stackoverflow.com/questions/13133434/requestanimationframe-detect-stop - // 浏览器最小化或切换标签,requestAnimationFrame 不会执行。 - // 检测时间超过 200 ms(频率小于 5Hz ) 判定为计时器暂停,重置为一帧长度 - // - if (dur > 200) { - dur = 1e3 / 60; - } - frame.dur = dur; - frame.elapsed += dur; - frame.time = time; - frame.action.call(null, frame); - frame.index++; + function executeFrame(frame) { + // 当前帧时间错 + var time = +new Date(); + // 当上一帧到当前帧经过的时间 + var dur = time - frame.time; + // + // http://stackoverflow.com/questions/13133434/requestanimationframe-detect-stop + // 浏览器最小化或切换标签,requestAnimationFrame 不会执行。 + // 检测时间超过 200 ms(频率小于 5Hz ) 判定为计时器暂停,重置为一帧长度 + // + if (dur > 200) { + dur = 1e3 / 60; + } + frame.dur = dur; + frame.elapsed += dur; + frame.time = time; + frame.action.call(null, frame); + frame.index++; + } + // 暴露 + exports.requestFrame = requestFrame; + exports.releaseFrame = releaseFrame; } - // 暴露 - exports.requestFrame = requestFrame; - exports.releaseFrame = releaseFrame; -}); +}; + +//src/animate/motionanimator.js /** * @fileOverview * * 路径动画器,可以让一个物体沿着某个轨迹运动 */ -define("animate/motionanimator", [ "animate/animator", "animate/timeline", "animate/easing", "core/class", "graphic/shape", "graphic/geometry", "core/utils", "graphic/point", "graphic/vector", "graphic/matrix", "graphic/path", "graphic/svg", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/pen", "graphic/box" ], function(require) { - var Animator = require("animate/animator"); - var g = require("graphic/geometry"); - var Path = require("graphic/path"); - var Shape = require("graphic/shape"); - /** +_p[3] = { + value: function(require) { + var Animator = _p.r(0); + var g = _p.r(35); + var Path = _p.r(47); + var Shape = _p.r(61); + /** * @class kity.MotionAnimator * @catalog animate * @base kity.Animator @@ -690,29 +688,28 @@ define("animate/motionanimator", [ "animate/animator", "animate/timeline", "anim * motionAnimator.start(rect, 3000); * ``` */ - var MotionAnimator = require("core/class").createClass("MotionAnimator", { - base: Animator, - /** + var MotionAnimator = _p.r(11).createClass("MotionAnimator", { + base: Animator, + /** * @constructor * @for kity.MotionAnimator * @grammar new kity.MotionAnimator(path, doRotate) * @param {kity.Path|String|PathSegment} path 运动的轨迹,或者是 kity.Path 对象 * @param {boolean} doRotate 是否让运动的目标沿着路径的切线方向旋转 */ - constructor: function(path, doRotate) { - var me = this; - this.callBase({ - beginValue: 0, - finishValue: 1, - setter: function(target, value) { - var path = me.motionPath instanceof Path ? me.motionPath.getPathData() : me.motionPath; - var point = g.pointAtPath(path, value); - target.setTranslate(point.x, point.y); - if (this.doRotate) target.setRotate(point.tan.getAngle()); - } - }); - this.updatePath(path); - /** + constructor: function(path, doRotate) { + var me = this; + this.callBase({ + beginValue: 0, + finishValue: 1, + setter: function(target, value) { + var path = me.motionPath instanceof Path ? me.motionPath.getPathData() : me.motionPath; + var point = g.pointAtPath(path, value); + target.setTranslate(point.x, point.y); + if (this.doRotate) target.setRotate(point.tan.getAngle()); + } + }); + /** * @property doRotate * @for kity.MotionAnimator * @type {boolean} @@ -724,18 +721,18 @@ define("animate/motionanimator", [ "animate/animator", "animate/timeline", "anim * motionAnimator.doRotate = true; // 目标沿着切线方向旋转 * ``` */ - this.doRotate = doRotate; - /** + this.doRotate = doRotate; + /** * @property motionPath * @for kity.MotionAnimator * @type {kity.Path|String|PathSegment} * @description 运动沿着的路径,可以在动画过程中更新 */ - this.motionPath = path; - } - }); - require("core/class").extendClass(Shape, { - /** + this.motionPath = path; + } + }); + _p.r(11).extendClass(Shape, { + /** * @method motion() * @catalog animate * @for kity.Shape @@ -749,49 +746,53 @@ define("animate/motionanimator", [ "animate/animator", "animate/timeline", "anim * @param {String|Function} easing 动画播放使用的缓动函数,如 'ease'、'linear'、'swing' * @param {Function} callback 播放结束之后的回调函数 */ - motion: function(path, duration, easing, delay, callback) { - return this.animate(new MotionAnimator(path), duration, easing, delay, callback); - } - }); - return MotionAnimator; -}); + motion: function(path, duration, easing, delay, callback) { + return this.animate(new MotionAnimator(path), duration, easing, delay, callback); + } + }); + return MotionAnimator; + } +}; + +//src/animate/opacityanimator.js /** * @fileOverview * * 透明度动画器,让图形动画过度到指定的透明度。 */ -define("animate/opacityanimator", [ "animate/animator", "animate/timeline", "animate/easing", "core/class", "graphic/shape", "graphic/svg", "core/utils", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box" ], function(require) { - var Animator = require("animate/animator"); - /** +_p[4] = { + value: function(require) { + var Animator = _p.r(0); + /** * @class kity.OpacityAnimator * @catalog animate * @base kity.Animator * @description 透明度动画器,让图形动画过度到指定的透明度 */ - var OpacityAnimator = require("core/class").createClass("OpacityAnimator", { - base: Animator, - /** + var OpacityAnimator = _p.r(11).createClass("OpacityAnimator", { + base: Animator, + /** * @constructor * @for kity.OpacityAnimator * @grammar new kity.OpacityAnimator(opacity) * * @param {Number} opacity 目标透明度,取值范围 0 - 1 */ - constructor: function(opacity) { - this.callBase({ - beginValue: function(target) { - return target.getOpacity(); - }, - finishValue: opacity, - setter: function(target, value) { - target.setOpacity(value); - } - }); - } - }); - var Shape = require("graphic/shape"); - require("core/class").extendClass(Shape, { - /** + constructor: function(opacity) { + this.callBase({ + beginValue: function(target) { + return target.getOpacity(); + }, + finishValue: opacity, + setter: function(target, value) { + target.setOpacity(value); + } + }); + } + }); + var Shape = _p.r(61); + _p.r(11).extendClass(Shape, { + /** * @method fxOpacity() * @catalog animate * @for kity.Shape @@ -805,10 +806,10 @@ define("animate/opacityanimator", [ "animate/animator", "animate/timeline", "ani * @param {String|Function} easing 动画播放使用的缓动函数,如 'ease'、'linear'、'swing' * @param {Function} callback 播放结束之后的回调函数 */ - fxOpacity: function(opacity, duration, easing, delay, callback) { - return this.animate(new OpacityAnimator(opacity), duration, easing, delay, callback); - }, - /** + fxOpacity: function(opacity, duration, easing, delay, callback) { + return this.animate(new OpacityAnimator(opacity), duration, easing, delay, callback); + }, + /** * @method fadeTo() * @catalog animate * @for kity.Shape @@ -822,10 +823,10 @@ define("animate/opacityanimator", [ "animate/animator", "animate/timeline", "ani * @param {String|Function} easing 动画播放使用的缓动函数,如 'ease'、'linear'、'swing' * @param {Function} callback 播放结束之后的回调函数 */ - fadeTo: function() { - return this.fxOpacity.apply(this, arguments); - }, - /** + fadeTo: function() { + return this.fxOpacity.apply(this, arguments); + }, + /** * @method fadeIn() * @catalog animate * @for kity.Shape @@ -838,10 +839,10 @@ define("animate/opacityanimator", [ "animate/animator", "animate/timeline", "ani * @param {String|Function} easing 动画播放使用的缓动函数,如 'ease'、'linear'、'swing' * @param {Function} callback 播放结束之后的回调函数 */ - fadeIn: function() { - return this.fxOpacity.apply(this, [ 1 ].concat([].slice.call(arguments))); - }, - /** + fadeIn: function() { + return this.fxOpacity.apply(this, [ 1 ].concat([].slice.call(arguments))); + }, + /** * @method fadeOut() * @catalog animate * @for kity.Shape @@ -854,21 +855,25 @@ define("animate/opacityanimator", [ "animate/animator", "animate/timeline", "ani * @param {String|Function} easing 动画播放使用的缓动函数,如 'ease'、'linear'、'swing' * @param {Function} callback 播放结束之后的回调函数 */ - fadeOut: function() { - return this.fxOpacity.apply(this, [ 0 ].concat([].slice.call(arguments))); - } - }); - return OpacityAnimator; -}); + fadeOut: function() { + return this.fxOpacity.apply(this, [ 0 ].concat([].slice.call(arguments))); + } + }); + return OpacityAnimator; + } +}; + +//src/animate/pathanimator.js /** * @fileOverview * * 路径补间动画器,让图形从一个形状变为另一个形状 */ -define("animate/pathanimator", [ "animate/animator", "animate/timeline", "animate/easing", "core/class", "graphic/shape", "graphic/geometry", "core/utils", "graphic/point", "graphic/vector", "graphic/matrix", "graphic/path", "graphic/svg" ], function(require) { - var Animator = require("animate/animator"); - var g = require("graphic/geometry"); - /** +_p[5] = { + value: function(require) { + var Animator = _p.r(0); + var g = _p.r(35); + /** * @catalog animate * * @class kity.PathAnimator @@ -883,9 +888,9 @@ define("animate/pathanimator", [ "animate/animator", "animate/timeline", "animat * pa.start(path, 300); * ``` */ - var PathAnimator = require("core/class").createClass("OpacityAnimator", { - base: Animator, - /** + var PathAnimator = _p.r(11).createClass("OpacityAnimator", { + base: Animator, + /** * @constructor * @for kity.PathAnimator * @@ -894,22 +899,22 @@ define("animate/pathanimator", [ "animate/animator", "animate/timeline", "animat * @param {String|PathSegment} path 目标形状的路径数据 * */ - constructor: function(path) { - this.callBase({ - beginValue: function(target) { - this.beginPath = target.getPathData(); - return 0; - }, - finishValue: 1, - setter: function(target, value) { - target.setPathData(g.pathTween(this.beginPath, path, value)); - } - }); - } - }); - var Path = require("graphic/path"); - require("core/class").extendClass(Path, { - /** + constructor: function(path) { + this.callBase({ + beginValue: function(target) { + this.beginPath = target.getPathData(); + return 0; + }, + finishValue: 1, + setter: function(target, value) { + target.setPathData(g.pathTween(this.beginPath, path, value)); + } + }); + } + }); + var Path = _p.r(47); + _p.r(11).extendClass(Path, { + /** * @catalog animate * * @method fxPath() @@ -924,27 +929,31 @@ define("animate/pathanimator", [ "animate/animator", "animate/timeline", "animat * @param {String|Function} easing 动画播放使用的缓动函数,如 'ease'、'linear'、'swing' * @param {Function} callback 播放结束之后的回调函数 */ - fxPath: function(path, duration, easing, delay, callback) { - return this.animate(new PathAnimator(path), duration, easing, delay, callback); - } - }); - return PathAnimator; -}); + fxPath: function(path, duration, easing, delay, callback) { + return this.animate(new PathAnimator(path), duration, easing, delay, callback); + } + }); + return PathAnimator; + } +}; + +//src/animate/rotateanimator.js /** * @fileOverview * * 提供支持目标旋转的动画器 */ -define("animate/rotateanimator", [ "animate/animator", "animate/timeline", "animate/easing", "core/class", "graphic/shape", "graphic/svg", "core/utils", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box" ], function(require) { - var Animator = require("animate/animator"); - /** +_p[6] = { + value: function(require) { + var Animator = _p.r(0); + /** * @class kity.RotateAnimator * @base Animator * @description 提供支持目标旋转的动画器 */ - var RotateAnimator = require("core/class").createClass("RotateAnimator", { - base: Animator, - /** + var RotateAnimator = _p.r(11).createClass("RotateAnimator", { + base: Animator, + /** * @constructor * @for kity.RotateAnimator * @@ -952,21 +961,21 @@ define("animate/rotateanimator", [ "animate/animator", "animate/timeline", "anim * * @param {Number} deg 要旋转的角度 */ - constructor: function(deg) { - this.callBase({ - beginValue: 0, - finishValue: deg, - setter: function(target, value, timeline) { - var delta = timeline.getDelta(); - target.rotate(delta, ax, ay); - } - }); - } - }); - var Shape = require("graphic/shape"); - require("core/class").extendClass(Shape, { - /** - * @method fxRotate() + constructor: function(deg) { + this.callBase({ + beginValue: 0, + finishValue: deg, + setter: function(target, value, timeline) { + var delta = timeline.getDelta(); + target.rotate(delta, ax, ay); + } + }); + } + }); + var Shape = _p.r(61); + _p.r(11).extendClass(Shape, { + /** + * @method fxRotate() * @for kity.Shape * @description 让目标以动画旋转指定的角度 * @@ -978,27 +987,31 @@ define("animate/rotateanimator", [ "animate/animator", "animate/timeline", "anim * @param {String|Function} easing 动画播放使用的缓动函数,如 'ease'、'linear'、'swing' * @param {Function} callback 播放结束之后的回调函数 */ - fxRotate: function(deg, duration, easing, delay, callback) { - return this.animate(new RotateAnimator(deg), duration, easing, delay, callback); - } - }); - return RotateAnimator; -}); + fxRotate: function(deg, duration, easing, delay, callback) { + return this.animate(new RotateAnimator(deg), duration, easing, delay, callback); + } + }); + return RotateAnimator; + } +}; + +//src/animate/scaleanimator.js /** * @fileOverview * * 提供支持目标缩放的动画器 */ -define("animate/scaleanimator", [ "animate/animator", "animate/timeline", "animate/easing", "core/class", "graphic/shape", "graphic/svg", "core/utils", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box" ], function(require) { - var Animator = require("animate/animator"); - /** +_p[7] = { + value: function(require) { + var Animator = _p.r(0); + /** * @class kity.ScaleAnimator * @base kity.Animator * @description 提供支持目标缩放的动画器 */ - var ScaleAnimator = require("core/class").createClass("ScaleAnimator", { - base: Animator, - /** + var ScaleAnimator = _p.r(11).createClass("ScaleAnimator", { + base: Animator, + /** * @constructor * @for kity.ScaleAnimator * @@ -1006,22 +1019,22 @@ define("animate/scaleanimator", [ "animate/animator", "animate/timeline", "anima * @param {Number} sx x 轴的缩放比例 * @param {Number} sy y 轴的缩放比例 */ - constructor: function(sx, sy) { - this.callBase({ - beginValue: 0, - finishValue: 1, - setter: function(target, value, timeline) { - var delta = timeline.getDelta(); - var kx = Math.pow(sx, delta); - var ky = Math.pow(sy, delta); - target.scale(ky, kx); - } - }); - } - }); - var Shape = require("graphic/shape"); - require("core/class").extendClass(Shape, { - /** + constructor: function(sx, sy) { + this.callBase({ + beginValue: 0, + finishValue: 1, + setter: function(target, value, timeline) { + var delta = timeline.getDelta(); + var kx = Math.pow(sx, delta); + var ky = Math.pow(sy, delta); + target.scale(ky, kx); + } + }); + } + }); + var Shape = _p.r(61); + _p.r(11).extendClass(Shape, { + /** * @method fxScale * @for kity.Shape * @description 动画缩放当前的图形 @@ -1035,175 +1048,179 @@ define("animate/scaleanimator", [ "animate/animator", "animate/timeline", "anima * @param {String|Function} easing 动画播放使用的缓动函数,如 'ease'、'linear'、'swing' * @param {Function} callback 播放结束之后的回调函数 */ - fxScale: function(sx, sy, duration, easing, delay, callback) { - return this.animate(new ScaleAnimator(sx, sy), duration, easing, delay, callback); - } - }); - return ScaleAnimator; -}); + fxScale: function(sx, sy, duration, easing, delay, callback) { + return this.animate(new ScaleAnimator(sx, sy), duration, easing, delay, callback); + } + }); + return ScaleAnimator; + } +}; + +//src/animate/timeline.js /** * @fileOverview * * 动画时间线的实现 */ -define("animate/timeline", [ "graphic/eventhandler", "core/utils", "graphic/shapeevent", "core/class", "animate/frame" ], function(require) { - var EventHandler = require("graphic/eventhandler"); - var frame = require("animate/frame"); - var utils = require("core/utils"); - function getPercentValue(b, f, p) { - return utils.paralle(b, f, function(b, f) { - return b + (f - b) * p; - }); - } - function getDelta(v1, v2) { - return utils.paralle(v1, v2, function(v1, v2) { - return v2 - v1; - }); - } - function TimelineEvent(timeline, type, param) { - this.timeline = timeline; - this.target = timeline.target; - this.type = type; - for (var name in param) { - if (param.hasOwnProperty(name)) { - this[name] = param[name]; +_p[8] = { + value: function(require) { + var EventHandler = _p.r(34); + var frame = _p.r(2); + var utils = _p.r(12); + function getPercentValue(b, f, p) { + return utils.paralle(b, f, function(b, f) { + return b + (f - b) * p; + }); + } + function getDelta(v1, v2) { + return utils.paralle(v1, v2, function(v1, v2) { + return v2 - v1; + }); + } + function TimelineEvent(timeline, type, param) { + this.timeline = timeline; + this.target = timeline.target; + this.type = type; + for (var name in param) { + if (param.hasOwnProperty(name)) { + this[name] = param[name]; + } } } - } - /** + /** * @class kity.Timeline * @catalog animate * @mixins EventHandler * @description 动画时间线 */ - var Timeline = require("core/class").createClass("Timeline", { - mixins: [ EventHandler ], - /** + var Timeline = _p.r(11).createClass("Timeline", { + mixins: [ EventHandler ], + /** * @constructor * @for kity.Timeline * @private * @description 时间线应该由动画器进行构造,不应手动创建 * */ - constructor: function(animator, target, duration, easing) { - this.callMixin(); - this.target = target; - this.time = 0; - this.duration = duration; - this.easing = easing; - this.animator = animator; - this.beginValue = animator.beginValue; - this.finishValue = animator.finishValue; - this.setter = animator.setter; - this.status = "ready"; - }, - /** + constructor: function(animator, target, duration, easing) { + this.callMixin(); + this.target = target; + this.time = 0; + this.duration = duration; + this.easing = easing; + this.animator = animator; + this.beginValue = animator.beginValue; + this.finishValue = animator.finishValue; + this.setter = animator.setter; + this.status = "ready"; + }, + /** * @private * * 让时间线进入下一帧 */ - nextFrame: function(frame) { - if (this.status != "playing") { - return; - } - this.time += frame.dur; - this.setValue(this.getValue()); - if (this.time >= this.duration) { - this.timeUp(); - } - frame.next(); - }, - /** + nextFrame: function(frame) { + if (this.status != "playing") { + return; + } + this.time += frame.dur; + this.setValue(this.getValue()); + if (this.time >= this.duration) { + this.timeUp(); + } + frame.next(); + }, + /** * @method getPlayTime() * @for kity.Timeline * @grammar getPlayTime() => {Number} * @description 获得当前播放的时间,取值区间为 [0, duration] */ - getPlayTime: function() { - return this.rollbacking ? this.duration - this.time : this.time; - }, - /** + getPlayTime: function() { + return this.rollbacking ? this.duration - this.time : this.time; + }, + /** * @method getTimeProportion() * @for kity.Timeline * @grammar getTimeProportion() => {Number} * @description 获得当前播放时间的比例,取值区间为 [0, 1] */ - getTimeProportion: function() { - return this.getPlayTime() / this.duration; - }, - /** + getTimeProportion: function() { + return this.getPlayTime() / this.duration; + }, + /** * @method getValueProportion() * @for kity.Timeline * @grammar getValueProportion() => {Number} * @description 获得当前播放时间对应值的比例,取值区间为 [0, 1];该值实际上是时间比例值经过缓动函数计算之后的值。 */ - getValueProportion: function() { - return this.easing(this.getPlayTime(), 0, 1, this.duration); - }, - /** + getValueProportion: function() { + return this.easing(this.getPlayTime(), 0, 1, this.duration); + }, + /** * @method getValue() * @for kity.Timeline * @grammar getValue() => {any} * @description 返回当前播放时间对应的值。 */ - getValue: function() { - var b = this.beginValue; - var f = this.finishValue; - var p = this.getValueProportion(); - return getPercentValue(b, f, p); - }, - /** + getValue: function() { + var b = this.beginValue; + var f = this.finishValue; + var p = this.getValueProportion(); + return getPercentValue(b, f, p); + }, + /** * @private * * 把值通过动画器的 setter 设置到目标上 */ - setValue: function(value) { - this.lastValue = this.currentValue; - this.currentValue = value; - this.setter.call(this.target, this.target, value, this); - }, - /** + setValue: function(value) { + this.lastValue = this.currentValue; + this.currentValue = value; + this.setter.call(this.target, this.target, value, this); + }, + /** * @method getDelta() * @for kity.Timeline * @grammar getDelta() => {any} * @description 返回当前值和上一帧的值的差值 */ - getDelta: function() { - this.lastValue = this.lastValue === undefined ? this.beginValue : this.lastValue; - return getDelta(this.lastValue, this.currentValue); - }, - /** + getDelta: function() { + this.lastValue = this.lastValue === undefined ? this.beginValue : this.lastValue; + return getDelta(this.lastValue, this.currentValue); + }, + /** * @method play() * @for kity.Timeline * @grammar play() => {this} * @description 让时间线播放,如果时间线还没开始,或者已停止、已结束,则重头播放;如果是已暂停,从暂停的位置继续播放 */ - play: function() { - var lastStatus = this.status; - this.status = "playing"; - switch (lastStatus) { - case "ready": - if (utils.isFunction(this.beginValue)) { - this.beginValue = this.beginValue.call(this.target, this.target); - } - if (utils.isFunction(this.finishValue)) { - this.finishValue = this.finishValue.call(this.target, this.target); - } - this.time = 0; - this.setValue(this.beginValue); - this.frame = frame.requestFrame(this.nextFrame.bind(this)); - break; + play: function() { + var lastStatus = this.status; + this.status = "playing"; + switch (lastStatus) { + case "ready": + if (utils.isFunction(this.beginValue)) { + this.beginValue = this.beginValue.call(this.target, this.target); + } + if (utils.isFunction(this.finishValue)) { + this.finishValue = this.finishValue.call(this.target, this.target); + } + this.time = 0; + this.setValue(this.beginValue); + this.frame = frame.requestFrame(this.nextFrame.bind(this)); + break; - case "finished": - case "stoped": - this.time = 0; - this.frame = frame.requestFrame(this.nextFrame.bind(this)); - break; + case "finished": + case "stoped": + this.time = 0; + this.frame = frame.requestFrame(this.nextFrame.bind(this)); + break; - case "paused": - this.frame.next(); - } - /** + case "paused": + this.frame.next(); + } + /** * @event play * @for kity.Timeline * @description 在时间线播放后触发 @@ -1211,114 +1228,114 @@ define("animate/timeline", [ "graphic/eventhandler", "core/utils", "graphic/shap * @param {String} event.lastStatus * 表示播放前的上一个状态,可能取值为 'ready'、'finished'、'stoped'、'paused' */ - this.fire("play", new TimelineEvent(this, "play", { - lastStatus: lastStatus - })); - return this; - }, - /** + this.fire("play", new TimelineEvent(this, "play", { + lastStatus: lastStatus + })); + return this; + }, + /** * @method pause() * @for kity.Timeline * @description 暂停当前的时间线 * * @grammar pause() => {this} */ - pause: function() { - this.status = "paused"; - /** + pause: function() { + this.status = "paused"; + /** * @event pause * @for kity.Timeline * @description 暂停事件,在时间线暂停时触发 */ - this.fire("pause", new TimelineEvent(this, "pause")); - frame.releaseFrame(this.frame); - return this; - }, - /** + this.fire("pause", new TimelineEvent(this, "pause")); + frame.releaseFrame(this.frame); + return this; + }, + /** * @method stop() * @for kity.Timeline * @description 停止当前时间线 * * @grammar stop() => {this} */ - stop: function() { - this.status = "stoped"; - this.setValue(this.finishValue); - this.rollbacking = false; - /** + stop: function() { + this.status = "stoped"; + this.setValue(this.finishValue); + this.rollbacking = false; + /** * @event stop * @for kity.Timeline * @description 停止时间,在时间线停止时触发 */ - this.fire("stop", new TimelineEvent(this, "stop")); - frame.releaseFrame(this.frame); - return this; - }, - /** + this.fire("stop", new TimelineEvent(this, "stop")); + frame.releaseFrame(this.frame); + return this; + }, + /** * @private * * 播放结束之后的处理 */ - timeUp: function() { - if (this.repeatOption) { - this.time = 0; - if (this.rollback) { - if (this.rollbacking) { - this.decreaseRepeat(); - this.rollbacking = false; - } else { - this.rollbacking = true; - /** + timeUp: function() { + if (this.repeatOption) { + this.time = 0; + if (this.rollback) { + if (this.rollbacking) { + this.decreaseRepeat(); + this.rollbacking = false; + } else { + this.rollbacking = true; + /** * @event rollback * @for kity.Timeline * @description 回滚事件,在时间线回滚播放开始的时候触发 */ - this.fire("rollback", new TimelineEvent(this, "rollback")); + this.fire("rollback", new TimelineEvent(this, "rollback")); + } + } else { + this.decreaseRepeat(); } - } else { - this.decreaseRepeat(); - } - if (!this.repeatOption) { - this.finish(); - } else { - /** + if (!this.repeatOption) { + this.finish(); + } else { + /** * @event repeat * @for kity.Timeline * @description 循环事件,在时间线循环播放开始的时候触发 */ - this.fire("repeat", new TimelineEvent(this, "repeat")); + this.fire("repeat", new TimelineEvent(this, "repeat")); + } + } else { + this.finish(); } - } else { - this.finish(); - } - }, - /** + }, + /** * @private * * 决定播放结束的处理 */ - finish: function() { - this.setValue(this.finishValue); - this.status = "finished"; - /** + finish: function() { + this.setValue(this.finishValue); + this.status = "finished"; + /** * @event finish * @for kity.Timeline * @description 结束事件,在时间线播放结束后触发(包括重复和回滚都结束) */ - this.fire("finish", new TimelineEvent(this, "finish")); - frame.releaseFrame(this.frame); - }, - /** + this.fire("finish", new TimelineEvent(this, "finish")); + frame.releaseFrame(this.frame); + }, + /** * @private * * 循环次数递减 */ - decreaseRepeat: function() { - if (this.repeatOption !== true) { - this.repeatOption--; - } - }, - /** + decreaseRepeat: function() { + if (this.repeatOption !== true) { + this.repeatOption--; + } + }, + /** * @method repeat() * @for kity.Timeline * @description 设置时间线的重复选项 @@ -1332,53 +1349,57 @@ define("animate/timeline", [ "graphic/eventhandler", "core/utils", "graphic/shap * 如果设置为真,一次事件到 duration 则一个来回算一次循环次数,否则播放完成一次算一次循环次数 * */ - repeat: function(repeat, rollback) { - this.repeatOption = repeat; - this.rollback = rollback; - return this; - } - }); - Timeline.requestFrame = frame.requestFrame; - Timeline.releaseFrame = frame.releaseFrame; - return Timeline; -}); + repeat: function(repeat, rollback) { + this.repeatOption = repeat; + this.rollback = rollback; + return this; + } + }); + Timeline.requestFrame = frame.requestFrame; + Timeline.releaseFrame = frame.releaseFrame; + return Timeline; + } +}; + +//src/animate/translateanimator.js /** * @fileOverview * * 提供让图形移动的动画器 */ -define("animate/translateanimator", [ "animate/animator", "animate/timeline", "animate/easing", "core/class", "graphic/shape", "graphic/svg", "core/utils", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box" ], function(require) { - var Animator = require("animate/animator"); - /** +_p[9] = { + value: function(require) { + var Animator = _p.r(0); + /** * @class kity.TranslateAnimator * @base kity.Animator * @description 提供让图形移动的动画器 */ - var TranslateAnimator = require("core/class").createClass("TranslateAnimator", { - base: Animator, - /** + var TranslateAnimator = _p.r(11).createClass("TranslateAnimator", { + base: Animator, + /** * @constructor * @for kity.TranslateAnimator * @grammar new kity.TranslateAnimator(x, y) * @param {Number} x x 方向上需要移动的距离 * @param {Number} y y 方向上需要移动的距离 */ - constructor: function(x, y) { - this.callBase({ - x: 0, - y: 0 - }, { - x: x, - y: y - }, function(target, value, timeline) { - var delta = timeline.getDelta(); - target.translate(delta.x, delta.y); - }); - } - }); - var Shape = require("graphic/shape"); - require("core/class").extendClass(Shape, { - /** + constructor: function(x, y) { + this.callBase({ + x: 0, + y: 0 + }, { + x: x, + y: y + }, function(target, value, timeline) { + var delta = timeline.getDelta(); + target.translate(delta.x, delta.y); + }); + } + }); + var Shape = _p.r(61); + _p.r(11).extendClass(Shape, { + /** * @method fxTranslate() * @for kity.Shape * @description 让目标以动画平移指定的距离 @@ -1392,122 +1413,130 @@ define("animate/translateanimator", [ "animate/animator", "animate/timeline", "a * @param {String|Function} easing 动画播放使用的缓动函数,如 'ease'、'linear'、'swing' * @param {Function} callback 播放结束之后的回调函数 */ - fxTranslate: function(x, y, duration, easing, delay, callback) { - return this.animate(new TranslateAnimator(x, y), duration, easing, delay, callback); - } - }); - return TranslateAnimator; -}); + fxTranslate: function(x, y, duration, easing, delay, callback) { + return this.animate(new TranslateAnimator(x, y), duration, easing, delay, callback); + } + }); + return TranslateAnimator; + } +}; + +//src/core/browser.js /** * @fileOverview * * 提供浏览器判断的一些字段 */ -define("core/browser", [], function() { - /** +_p[10] = { + value: function() { + /** * @class kity.Browser * @catalog core * @static * @description 提供浏览器信息 */ - var browser = function() { - var agent = navigator.userAgent.toLowerCase(), opera = window.opera, browser; - // 浏览器对象 - browser = { - /** + var browser = function() { + var agent = navigator.userAgent.toLowerCase(), opera = window.opera, browser; + // 浏览器对象 + browser = { + /** * @property ie * @for kity.Browser * @description 判断是否为 IE 浏览器 * @type {boolean} */ - ie: /(msie\s|trident.*rv:)([\w.]+)/.test(agent), - /** + ie: /(msie\s|trident.*rv:)([\w.]+)/.test(agent), + /** * @property opera * @for kity.Browser * @description 判断是否为 Opera 浏览器 * @type {boolean} */ - opera: !!opera && opera.version, - /** + opera: !!opera && opera.version, + /** * @property webkit * @for kity.Browser * @description 判断是否为 Webkit 内核的浏览器 * @type {boolean} */ - webkit: agent.indexOf(" applewebkit/") > -1, - /** + webkit: agent.indexOf(" applewebkit/") > -1, + /** * @property mac * @for kity.Browser * @description 判断是否为 Mac 下的浏览器 * @type {boolean} */ - mac: agent.indexOf("macintosh") > -1 - }; - browser.gecko = navigator.product == "Gecko" && !browser.webkit && !browser.opera && !browser.ie; - var version = 0; - // Internet Explorer 6.0+ - if (browser.ie) { - version = (agent.match(/(msie\s|trident.*rv:)([\w.]+)/)[2] || 0) * 1; - browser.ie11Compat = document.documentMode == 11; - browser.ie9Compat = document.documentMode == 9; - } - // Gecko. - if (browser.gecko) { - var geckoRelease = agent.match(/rv:([\d\.]+)/); - if (geckoRelease) { - geckoRelease = geckoRelease[1].split("."); - version = geckoRelease[0] * 1e4 + (geckoRelease[1] || 0) * 100 + (geckoRelease[2] || 0) * 1; + mac: agent.indexOf("macintosh") > -1 + }; + browser.gecko = navigator.product == "Gecko" && !browser.webkit && !browser.opera && !browser.ie; + var version = 0; + // Internet Explorer 6.0+ + if (browser.ie) { + version = (agent.match(/(msie\s|trident.*rv:)([\w.]+)/)[2] || 0) * 1; + browser.ie11Compat = document.documentMode == 11; + browser.ie9Compat = document.documentMode == 9; + } + // Gecko. + if (browser.gecko) { + var geckoRelease = agent.match(/rv:([\d\.]+)/); + if (geckoRelease) { + geckoRelease = geckoRelease[1].split("."); + version = geckoRelease[0] * 1e4 + (geckoRelease[1] || 0) * 100 + (geckoRelease[2] || 0) * 1; + } } - } - if (/chrome\/(\d+\.\d)/i.test(agent)) { - /** + if (/chrome\/(\d+\.\d)/i.test(agent)) { + /** * @property chrome * @for kity.Browser * @description 判断是否为 Chrome 浏览器 * @type {boolean} */ - browser.chrome = +RegExp["$1"]; - } - if (/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(agent) && !/chrome/i.test(agent)) { - browser.safari = +(RegExp["$1"] || RegExp["$2"]); - } - // Opera 9.50+ - if (browser.opera) version = parseFloat(opera.version()); - // WebKit 522+ (Safari 3+) - if (browser.webkit) version = parseFloat(agent.match(/ applewebkit\/(\d+)/)[1]); - /** + browser.chrome = +RegExp["$1"]; + } + if (/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(agent) && !/chrome/i.test(agent)) { + browser.safari = +(RegExp["$1"] || RegExp["$2"]); + } + // Opera 9.50+ + if (browser.opera) version = parseFloat(opera.version()); + // WebKit 522+ (Safari 3+) + if (browser.webkit) version = parseFloat(agent.match(/ applewebkit\/(\d+)/)[1]); + /** * @property version * @for kity.Browser * @description 获取当前浏览器的版本 * @type {Number} */ - browser.version = version; - browser.isCompatible = !browser.mobile && (browser.ie && version >= 6 || browser.gecko && version >= 10801 || browser.opera && version >= 9.5 || browser.air && version >= 1 || browser.webkit && version >= 522 || false); + browser.version = version; + browser.isCompatible = !browser.mobile && (browser.ie && version >= 6 || browser.gecko && version >= 10801 || browser.opera && version >= 9.5 || browser.air && version >= 1 || browser.webkit && version >= 522 || false); + return browser; + }(); return browser; - }(); - return browser; -}); + } +}; + +//src/core/class.js /** * @fileOverview * * 提供 Kity 的 OOP 支持 */ -define("core/class", [], function(require, exports) { - // just to bind context - Function.prototype.bind = Function.prototype.bind || function(thisObj) { - var args = Array.prototype.slice.call(arguments, 1); - return this.apply(thisObj, args); - }; - /** +_p[11] = { + value: function(require, exports) { + // just to bind context + Function.prototype.bind = Function.prototype.bind || function(thisObj) { + var args = Array.prototype.slice.call(arguments, 1); + return this.apply(thisObj, args); + }; + /** * @class kity.Class * @catalog core * @description 所有 kity 类的基类 * @abstract */ - function Class() {} - exports.Class = Class; - Class.__KityClassName = "Class"; - /** + function Class() {} + exports.Class = Class; + Class.__KityClassName = "Class"; + /** * @method base() * @for kity.Class * @protected @@ -1538,12 +1567,12 @@ define("core/class", [], function(require, exports) { * }) * ``` */ - Class.prototype.base = function(name) { - var caller = arguments.callee.caller; - var method = caller.__KityMethodClass.__KityBaseClass.prototype[name]; - return method.apply(this, Array.prototype.slice.call(arguments, 1)); - }; - /** + Class.prototype.base = function(name) { + var caller = arguments.callee.caller; + var method = caller.__KityMethodClass.__KityBaseClass.prototype[name]; + return method.apply(this, Array.prototype.slice.call(arguments, 1)); + }; + /** * @method callBase() * @for kity.Class * @protected @@ -1576,38 +1605,38 @@ define("core/class", [], function(require, exports) { * console.log(dog.toString()); // "I am an animal name Dummy, a dog"; * ``` */ - Class.prototype.callBase = function() { - var caller = arguments.callee.caller; - var method = caller.__KityMethodClass.__KityBaseClass.prototype[caller.__KityMethodName]; - return method.apply(this, arguments); - }; - Class.prototype.mixin = function(name) { - var caller = arguments.callee.caller; - var mixins = caller.__KityMethodClass.__KityMixins; - if (!mixins) { - return this; - } - var method = mixins[name]; - return method.apply(this, Array.prototype.slice.call(arguments, 1)); - }; - Class.prototype.callMixin = function() { - var caller = arguments.callee.caller; - var methodName = caller.__KityMethodName; - var mixins = caller.__KityMethodClass.__KityMixins; - if (!mixins) { - return this; - } - var method = mixins[methodName]; - if (methodName == "constructor") { - for (var i = 0, l = method.length; i < l; i++) { - method[i].call(this); - } - return this; - } else { + Class.prototype.callBase = function() { + var caller = arguments.callee.caller; + var method = caller.__KityMethodClass.__KityBaseClass.prototype[caller.__KityMethodName]; return method.apply(this, arguments); - } - }; - /** + }; + Class.prototype.mixin = function(name) { + var caller = arguments.callee.caller; + var mixins = caller.__KityMethodClass.__KityMixins; + if (!mixins) { + return this; + } + var method = mixins[name]; + return method.apply(this, Array.prototype.slice.call(arguments, 1)); + }; + Class.prototype.callMixin = function() { + var caller = arguments.callee.caller; + var methodName = caller.__KityMethodName; + var mixins = caller.__KityMethodClass.__KityMixins; + if (!mixins) { + return this; + } + var method = mixins[methodName]; + if (methodName == "constructor") { + for (var i = 0, l = method.length; i < l; i++) { + method[i].call(this); + } + return this; + } else { + return method.apply(this, arguments); + } + }; + /** * @method pipe() * @for kity.Class * @grammar pipe() => {this} @@ -1623,13 +1652,13 @@ define("core/class", [], function(require, exports) { * }); * ``` */ - Class.prototype.pipe = function(fn) { - if (typeof fn == "function") { - fn.call(this, this); - } - return this; - }; - /** + Class.prototype.pipe = function(fn) { + if (typeof fn == "function") { + fn.call(this, this); + } + return this; + }; + /** * @method getType() * @for kity.Class * @grammar getType() => {string} @@ -1645,10 +1674,10 @@ define("core/class", [], function(require, exports) { * console.log(rect.getType()); // "Circle" * ``` */ - Class.prototype.getType = function() { - return this.__KityClassName; - }; - /** + Class.prototype.getType = function() { + return this.__KityClassName; + }; + /** * @method getClass() * @for kity.Class * @grammar getClass() => {Class} @@ -1663,68 +1692,68 @@ define("core/class", [], function(require, exports) { * console.log(rect instanceof kity.Rect); // true * ``` */ - Class.prototype.getClass = function() { - return this.constructor; - }; - // 检查基类是否调用了父类的构造函数 - // 该检查是弱检查,假如调用的代码被注释了,同样能检查成功(这个特性可用于知道建议调用,但是出于某些原因不想调用的情况) - function checkBaseConstructorCall(targetClass, classname) { - var code = targetClass.toString(); - if (!/this\.callBase/.test(code)) { - throw new Error(classname + " : 类构造函数没有调用父类的构造函数!为了安全,请调用父类的构造函数"); - } - } - var KITY_INHERIT_FLAG = "__KITY_INHERIT_FLAG_" + +new Date(); - function inherit(constructor, BaseClass, classname) { - var KityClass = eval("(function " + classname + "( __inherit__flag ) {" + "if( __inherit__flag != KITY_INHERIT_FLAG ) {" + "KityClass.__KityConstructor.apply(this, arguments);" + "}" + "this.__KityClassName = KityClass.__KityClassName;" + "})"); - KityClass.__KityConstructor = constructor; - KityClass.prototype = new BaseClass(KITY_INHERIT_FLAG); - for (var methodName in BaseClass.prototype) { - if (BaseClass.prototype.hasOwnProperty(methodName) && methodName.indexOf("__Kity") !== 0) { - KityClass.prototype[methodName] = BaseClass.prototype[methodName]; - } - } - KityClass.prototype.constructor = KityClass; - return KityClass; - } - function mixin(NewClass, mixins) { - if (false === mixins instanceof Array) { - return NewClass; - } - var i, length = mixins.length, proto, method; - NewClass.__KityMixins = { - constructor: [] + Class.prototype.getClass = function() { + return this.constructor; }; - for (i = 0; i < length; i++) { - proto = mixins[i].prototype; - for (method in proto) { - if (false === proto.hasOwnProperty(method) || method.indexOf("__Kity") === 0) { - continue; - } - if (method === "constructor") { - // constructor 特殊处理 - NewClass.__KityMixins.constructor.push(proto[method]); - } else { - NewClass.prototype[method] = NewClass.__KityMixins[method] = proto[method]; + // 检查基类是否调用了父类的构造函数 + // 该检查是弱检查,假如调用的代码被注释了,同样能检查成功(这个特性可用于知道建议调用,但是出于某些原因不想调用的情况) + function checkBaseConstructorCall(targetClass, classname) { + var code = targetClass.toString(); + if (!/this\.callBase/.test(code)) { + throw new Error(classname + " : 类构造函数没有调用父类的构造函数!为了安全,请调用父类的构造函数"); + } + } + var KITY_INHERIT_FLAG = "__KITY_INHERIT_FLAG_" + +new Date(); + function inherit(constructor, BaseClass, classname) { + var KityClass = eval("(function " + classname + "( __inherit__flag ) {" + "if( __inherit__flag != KITY_INHERIT_FLAG ) {" + "KityClass.__KityConstructor.apply(this, arguments);" + "}" + "this.__KityClassName = KityClass.__KityClassName;" + "})"); + KityClass.__KityConstructor = constructor; + KityClass.prototype = new BaseClass(KITY_INHERIT_FLAG); + for (var methodName in BaseClass.prototype) { + if (BaseClass.prototype.hasOwnProperty(methodName) && methodName.indexOf("__Kity") !== 0) { + KityClass.prototype[methodName] = BaseClass.prototype[methodName]; } } + KityClass.prototype.constructor = KityClass; + return KityClass; } - return NewClass; - } - function extend(BaseClass, extension) { - if (extension.__KityClassName) { - extension = extension.prototype; + function mixin(NewClass, mixins) { + if (false === mixins instanceof Array) { + return NewClass; + } + var i, length = mixins.length, proto, method; + NewClass.__KityMixins = { + constructor: [] + }; + for (i = 0; i < length; i++) { + proto = mixins[i].prototype; + for (method in proto) { + if (false === proto.hasOwnProperty(method) || method.indexOf("__Kity") === 0) { + continue; + } + if (method === "constructor") { + // constructor 特殊处理 + NewClass.__KityMixins.constructor.push(proto[method]); + } else { + NewClass.prototype[method] = NewClass.__KityMixins[method] = proto[method]; + } + } + } + return NewClass; } - for (var methodName in extension) { - if (extension.hasOwnProperty(methodName) && methodName.indexOf("__Kity") && methodName != "constructor") { - var method = BaseClass.prototype[methodName] = extension[methodName]; - method.__KityMethodClass = BaseClass; - method.__KityMethodName = methodName; + function extend(BaseClass, extension) { + if (extension.__KityClassName) { + extension = extension.prototype; + } + for (var methodName in extension) { + if (extension.hasOwnProperty(methodName) && methodName.indexOf("__Kity") && methodName != "constructor") { + var method = BaseClass.prototype[methodName] = extension[methodName]; + method.__KityMethodClass = BaseClass; + method.__KityMethodName = methodName; + } } + return BaseClass; } - return BaseClass; - } - /** + /** * @method kity.createClass() * @grammar kity.createClass(classname, defines) => {Class} * @description 创建一个类 @@ -1798,38 +1827,38 @@ define("core/class", [], function(require, exports) { * dog.walk(); * ``` */ - exports.createClass = function(classname, defines) { - var constructor, NewClass, BaseClass; - if (arguments.length === 1) { - defines = arguments[0]; - classname = "AnonymousClass"; - } - BaseClass = defines.base || Class; - if (defines.hasOwnProperty("constructor")) { - constructor = defines.constructor; - if (BaseClass != Class) { - checkBaseConstructorCall(constructor, classname); + exports.createClass = function(classname, defines) { + var constructor, NewClass, BaseClass; + if (arguments.length === 1) { + defines = arguments[0]; + classname = "AnonymousClass"; + } + BaseClass = defines.base || Class; + if (defines.hasOwnProperty("constructor")) { + constructor = defines.constructor; + if (BaseClass != Class) { + checkBaseConstructorCall(constructor, classname); + } + } else { + constructor = function() { + this.callBase.apply(this, arguments); + this.callMixin.apply(this, arguments); + }; } - } else { - constructor = function() { - this.callBase.apply(this, arguments); - this.callMixin.apply(this, arguments); - }; - } - NewClass = inherit(constructor, BaseClass, classname); - NewClass = mixin(NewClass, defines.mixins); - NewClass.__KityClassName = constructor.__KityClassName = classname; - NewClass.__KityBaseClass = constructor.__KityBaseClass = BaseClass; - NewClass.__KityMethodName = constructor.__KityMethodName = "constructor"; - NewClass.__KityMethodClass = constructor.__KityMethodClass = NewClass; - // 下面这些不需要拷贝到原型链上 - delete defines.mixins; - delete defines.constructor; - delete defines.base; - NewClass = extend(NewClass, defines); - return NewClass; - }; - /** + NewClass = inherit(constructor, BaseClass, classname); + NewClass = mixin(NewClass, defines.mixins); + NewClass.__KityClassName = constructor.__KityClassName = classname; + NewClass.__KityBaseClass = constructor.__KityBaseClass = BaseClass; + NewClass.__KityMethodName = constructor.__KityMethodName = "constructor"; + NewClass.__KityMethodClass = constructor.__KityMethodClass = NewClass; + // 下面这些不需要拷贝到原型链上 + delete defines.mixins; + delete defines.constructor; + delete defines.base; + NewClass = extend(NewClass, defines); + return NewClass; + }; + /** * @method kity.extendClass() * @grammar kity.extendClass(clazz, extension) => {Class} * @description 拓展一个已有的类 @@ -1846,22 +1875,26 @@ define("core/class", [], function(require, exports) { * new Dog().spark(); // "wao wao wao!"; * ``` */ - exports.extendClass = extend; -}); + exports.extendClass = extend; + } +}; + +//src/core/utils.js /** * @fileOverview * * 一些常用的工具方法 */ -define("core/utils", [], function() { - /** +_p[12] = { + value: function() { + /** * @class kity.Utils * @catalog core * @static * @description 提供常用的工具方法 */ - var utils = { - /** + var utils = { + /** * @method each() * @for kity.Utils * @grammar each(obj, interator, context) @@ -1896,27 +1929,27 @@ define("core/utils", [], function() { * console.log(param.join('&')); // "name=kity&version=1.2.1" * ``` */ - each: function(obj, iterator, context) { - if (obj === null) { - return; - } - if (obj.length === +obj.length) { - for (var i = 0, l = obj.length; i < l; i++) { - if (iterator.call(context, obj[i], i, obj) === false) { - return false; - } + each: function(obj, iterator, context) { + if (obj === null) { + return; } - } else { - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - if (iterator.call(context, obj[key], key, obj) === false) { + if (obj.length === +obj.length) { + for (var i = 0, l = obj.length; i < l; i++) { + if (iterator.call(context, obj[i], i, obj) === false) { return false; } } - } - } - }, - /** + } else { + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + if (iterator.call(context, obj[key], key, obj) === false) { + return false; + } + } + } + } + }, + /** * @method extend() * @for kity.Utils * @grammar extend(target, sources..., notCover) => {object} @@ -1948,19 +1981,19 @@ define("core/utils", [], function() { * console.log(a); // {key1: 'a1', key2: 'b2', key3: 'b3', key4: 'c4'} * ``` */ - extend: function(t) { - var a = arguments, notCover = this.isBoolean(a[a.length - 1]) ? a[a.length - 1] : false, len = this.isBoolean(a[a.length - 1]) ? a.length - 1 : a.length; - for (var i = 1; i < len; i++) { - var x = a[i]; - for (var k in x) { - if (!notCover || !t.hasOwnProperty(k)) { - t[k] = x[k]; + extend: function(t) { + var a = arguments, notCover = this.isBoolean(a[a.length - 1]) ? a[a.length - 1] : false, len = this.isBoolean(a[a.length - 1]) ? a.length - 1 : a.length; + for (var i = 1; i < len; i++) { + var x = a[i]; + for (var k in x) { + if (!notCover || !t.hasOwnProperty(k)) { + t[k] = x[k]; + } } } - } - return t; - }, - /** + return t; + }, + /** * @method deepExtend() * @for kity.Utils * @grammar deepExtend(target, sources..., notCover) @@ -1969,23 +2002,23 @@ define("core/utils", [], function() { * @param {parameter} sources 源对象 * @param {boolean} notCover 是否不要覆盖源对象已有的属性 */ - deepExtend: function(t, s) { - var a = arguments, notCover = this.isBoolean(a[a.length - 1]) ? a[a.length - 1] : false, len = this.isBoolean(a[a.length - 1]) ? a.length - 1 : a.length; - for (var i = 1; i < len; i++) { - var x = a[i]; - for (var k in x) { - if (!notCover || !t.hasOwnProperty(k)) { - if (this.isObject(t[k]) && this.isObject(x[k])) { - this.deepExtend(t[k], x[k], notCover); - } else { - t[k] = x[k]; + deepExtend: function(t, s) { + var a = arguments, notCover = this.isBoolean(a[a.length - 1]) ? a[a.length - 1] : false, len = this.isBoolean(a[a.length - 1]) ? a.length - 1 : a.length; + for (var i = 1; i < len; i++) { + var x = a[i]; + for (var k in x) { + if (!notCover || !t.hasOwnProperty(k)) { + if (this.isObject(t[k]) && this.isObject(x[k])) { + this.deepExtend(t[k], x[k], notCover); + } else { + t[k] = x[k]; + } } } } - } - return t; - }, - /** + return t; + }, + /** * @method clone() * @for kity.Utils * @grammar clone(obj) => {object} @@ -2009,16 +2042,16 @@ define("core/utils", [], function() { * console.log(target.key3 === source.key3); // true * ``` */ - clone: function(obj) { - var cloned = {}; - for (var m in obj) { - if (obj.hasOwnProperty(m)) { - cloned[m] = obj[m]; + clone: function(obj) { + var cloned = {}; + for (var m in obj) { + if (obj.hasOwnProperty(m)) { + cloned[m] = obj[m]; + } } - } - return cloned; - }, - /** + return cloned; + }, + /** * @method copy() * @for kity.Utils * @grammar copy(obj) => {object} @@ -2042,30 +2075,30 @@ define("core/utils", [], function() { * console.log(target.key3 === source.key3); // true,因为是值类型 * ``` */ - copy: function(obj) { - if (typeof obj !== "object") return obj; - if (typeof obj === "function") return null; - return JSON.parse(JSON.stringify(obj)); - }, - queryPath: function(path, obj) { - var arr = path.split("."); - var i = 0, tmp = obj, l = arr.length; - while (i < l) { - if (arr[i] in tmp) { - tmp = tmp[arr[i]]; - i++; - if (i >= l || tmp === undefined) { - return tmp; + copy: function(obj) { + if (typeof obj !== "object") return obj; + if (typeof obj === "function") return null; + return JSON.parse(JSON.stringify(obj)); + }, + queryPath: function(path, obj) { + var arr = path.split("."); + var i = 0, tmp = obj, l = arr.length; + while (i < l) { + if (arr[i] in tmp) { + tmp = tmp[arr[i]]; + i++; + if (i >= l || tmp === undefined) { + return tmp; + } + } else { + return undefined; } - } else { - return undefined; } - } - }, - getValue: function(value, defaultValue) { - return value !== undefined ? value : defaultValue; - }, - /** + }, + getValue: function(value, defaultValue) { + return value !== undefined ? value : defaultValue; + }, + /** * @method flatten() * @for kity.Utils * @grammar flatten(arr) => {Array} @@ -2079,18 +2112,18 @@ define("core/utils", [], function() { * console.log(flattened); // [1, 2, 3, 4, 5, 6, 7]; * ``` */ - flatten: function(arr) { - var result = [], length = arr.length, i; - for (i = 0; i < length; i++) { - if (arr[i] instanceof Array) { - result = result.concat(utils.flatten(arr[i])); - } else { - result.push(arr[i]); + flatten: function(arr) { + var result = [], length = arr.length, i; + for (i = 0; i < length; i++) { + if (arr[i] instanceof Array) { + result = result.concat(utils.flatten(arr[i])); + } else { + result.push(arr[i]); + } } - } - return result; - }, - /** + return result; + }, + /** * @method paralle() * @for kity.Utils * @grammar paralle() => {Any} @@ -2132,444 +2165,488 @@ define("core/utils", [], function() { * * ``` */ - paralle: function(v1, v2, op) { - var Class, field, index, name, value; - // 数组 - if (v1 instanceof Array) { - value = []; - for (index = 0; index < v1.length; index++) { - value.push(utils.paralle(v1[index], v2[index], op)); + paralle: function(v1, v2, op) { + var Class, field, index, name, value; + // 数组 + if (v1 instanceof Array) { + value = []; + for (index = 0; index < v1.length; index++) { + value.push(utils.paralle(v1[index], v2[index], op)); + } + return value; } - return value; - } - // 对象 - if (v1 instanceof Object) { - // 如果值是一个支持原始表示的实例,获取其原始表示 - Class = v1.getClass && v1.getClass(); - if (Class && Class.parse) { - v1 = v1.valueOf(); - v2 = v2.valueOf(); - value = utils.paralle(v1, v2, op); - value = Class.parse(value); - } else { - value = {}; - for (name in v1) { - if (v1.hasOwnProperty(name) && v2.hasOwnProperty(name)) { - value[name] = utils.paralle(v1[name], v2[name], op); + // 对象 + if (v1 instanceof Object) { + // 如果值是一个支持原始表示的实例,获取其原始表示 + Class = v1.getClass && v1.getClass(); + if (Class && Class.parse) { + v1 = v1.valueOf(); + v2 = v2.valueOf(); + value = utils.paralle(v1, v2, op); + value = Class.parse(value); + } else { + value = {}; + for (name in v1) { + if (v1.hasOwnProperty(name) && v2.hasOwnProperty(name)) { + value[name] = utils.paralle(v1[name], v2[name], op); + } } } + return value; + } + // 是否数字 + if (false === isNaN(parseFloat(v1))) { + return op(v1, v2); } return value; - } - // 是否数字 - if (false === isNaN(parseFloat(v1))) { - return op(v1, v2); - } - return value; - }, - /** + }, + /** * 创建 op 操作的一个平行化版本 */ - parallelize: function(op) { - return function(v1, v2) { - return utils.paralle(v1, v2, op); - }; - } - }; - /** + parallelize: function(op) { + return function(v1, v2) { + return utils.paralle(v1, v2, op); + }; + } + }; + /** * @method isString() * @for kity.Utils * @grammar isString(unknown) => {boolean} * @description 判断一个值是否为字符串类型 * @param {any} unknown 要判断的值 */ - /** + /** * @method isFunction() * @for kity.Utils * @grammar isFunction(unknown) => {boolean} * @description 判断一个值是否为函数类型 * @param {any} unknown 要判断的值 */ - /** + /** * @method isArray() * @for kity.Utils * @grammar isArray(unknown) => {boolean} * @description 判断一个值是否为数组类型 * @param {any} unknown 要判断的值 */ - /** + /** * @method isNumber() * @for kity.Utils * @grammar isNumber(unknown) => {boolean} * @description 判断一个值是否为数字类型 * @param {any} unknown 要判断的值 */ - /** + /** * @method isRegExp() * @for kity.Utils * @grammar isRegExp(unknown) => {boolean} * @description 判断一个值是否为正则表达式类型 * @param {any} unknown 要判断的值 */ - /** + /** * @method isObject() * @for kity.Utils * @grammar isObject(unknown) => {boolean} * @description 判断一个值是否为对象类型 * @param {any} unknown 要判断的值 */ - /** + /** * @method isBoolean() * @for kity.Utils * @grammar isBoolean(unknown) => {boolean} * @description 判断一个值是否为布尔类型 * @param {any} unknown 要判断的值 */ - utils.each([ "String", "Function", "Array", "Number", "RegExp", "Object", "Boolean" ], function(v) { - utils["is" + v] = function(obj) { - return Object.prototype.toString.apply(obj) == "[object " + v + "]"; - }; - }); - return utils; -}); + utils.each([ "String", "Function", "Array", "Number", "RegExp", "Object", "Boolean" ], function(v) { + utils["is" + v] = function(obj) { + return Object.prototype.toString.apply(obj) == "[object " + v + "]"; + }; + }); + return utils; + } +}; + +//src/filter/effect/colormatrixeffect.js /** * 颜色矩阵运算效果封装 */ -define("filter/effect/colormatrixeffect", [ "filter/effect/effect", "graphic/svg", "core/class", "core/utils" ], function(require, exports, module) { - var Effect = require("filter/effect/effect"), Utils = require("core/utils"); - var ColorMatrixEffect = require("core/class").createClass("ColorMatrixEffect", { - base: Effect, - constructor: function(type, input) { - this.callBase(Effect.NAME_COLOR_MATRIX); - this.set("type", Utils.getValue(type, ColorMatrixEffect.TYPE_MATRIX)); - this.set("in", Utils.getValue(input, Effect.INPUT_SOURCE_GRAPHIC)); - } - }); - Utils.extend(ColorMatrixEffect, { - // 类型常量 - TYPE_MATRIX: "matrix", - TYPE_SATURATE: "saturate", - TYPE_HUE_ROTATE: "hueRotate", - TYPE_LUMINANCE_TO_ALPHA: "luminanceToAlpha", - // 矩阵常量 - MATRIX_ORIGINAL: "10000010000010000010".split("").join(" "), - MATRIX_EMPTY: "00000000000000000000".split("").join(" ") - }); - return ColorMatrixEffect; -}); +_p[13] = { + value: function(require, exports, module) { + var Effect = _p.r(16), Utils = _p.r(12); + var ColorMatrixEffect = _p.r(11).createClass("ColorMatrixEffect", { + base: Effect, + constructor: function(type, input) { + this.callBase(Effect.NAME_COLOR_MATRIX); + this.set("type", Utils.getValue(type, ColorMatrixEffect.TYPE_MATRIX)); + this.set("in", Utils.getValue(input, Effect.INPUT_SOURCE_GRAPHIC)); + } + }); + Utils.extend(ColorMatrixEffect, { + // 类型常量 + TYPE_MATRIX: "matrix", + TYPE_SATURATE: "saturate", + TYPE_HUE_ROTATE: "hueRotate", + TYPE_LUMINANCE_TO_ALPHA: "luminanceToAlpha", + // 矩阵常量 + MATRIX_ORIGINAL: "10000010000010000010".split("").join(" "), + MATRIX_EMPTY: "00000000000000000000".split("").join(" ") + }); + return ColorMatrixEffect; + } +}; + +//src/filter/effect/compositeeffect.js /** * 高斯模糊效果封装 */ -define("filter/effect/compositeeffect", [ "filter/effect/effect", "graphic/svg", "core/class", "core/utils" ], function(require, exports, module) { - var Effect = require("filter/effect/effect"), Utils = require("core/utils"); - var CompositeEffect = require("core/class").createClass("CompositeEffect", { - base: Effect, - constructor: function(operator, input, input2) { - this.callBase(Effect.NAME_COMPOSITE); - this.set("operator", Utils.getValue(operator, CompositeEffect.OPERATOR_OVER)); - if (input) { - this.set("in", input); - } - if (input2) { - this.set("in2", input2); +_p[14] = { + value: function(require, exports, module) { + var Effect = _p.r(16), Utils = _p.r(12); + var CompositeEffect = _p.r(11).createClass("CompositeEffect", { + base: Effect, + constructor: function(operator, input, input2) { + this.callBase(Effect.NAME_COMPOSITE); + this.set("operator", Utils.getValue(operator, CompositeEffect.OPERATOR_OVER)); + if (input) { + this.set("in", input); + } + if (input2) { + this.set("in2", input2); + } } - } - }); - Utils.extend(CompositeEffect, { - // operator 常量 - OPERATOR_OVER: "over", - OPERATOR_IN: "in", - OPERATOR_OUT: "out", - OPERATOR_ATOP: "atop", - OPERATOR_XOR: "xor", - OPERATOR_ARITHMETIC: "arithmetic" - }); - return CompositeEffect; -}); + }); + Utils.extend(CompositeEffect, { + // operator 常量 + OPERATOR_OVER: "over", + OPERATOR_IN: "in", + OPERATOR_OUT: "out", + OPERATOR_ATOP: "atop", + OPERATOR_XOR: "xor", + OPERATOR_ARITHMETIC: "arithmetic" + }); + return CompositeEffect; + } +}; + +//src/filter/effect/convolvematrixeffect.js /** * 像素级别的矩阵卷积运算效果封装 */ -define("filter/effect/convolvematrixeffect", [ "filter/effect/effect", "graphic/svg", "core/class", "core/utils" ], function(require, exports, module) { - var Effect = require("filter/effect/effect"), Utils = require("core/utils"); - var ConvolveMatrixEffect = require("core/class").createClass("ConvolveMatrixEffect", { - base: Effect, - constructor: function(edgeMode, input) { - this.callBase(Effect.NAME_CONVOLVE_MATRIX); - this.set("edgeMode", Utils.getValue(edgeMode, ConvolveMatrixEffect.MODE_DUPLICATE)); - this.set("in", Utils.getValue(input, Effect.INPUT_SOURCE_GRAPHIC)); - } - }); - Utils.extend(ConvolveMatrixEffect, { - MODE_DUPLICATE: "duplicate", - MODE_WRAP: "wrap", - MODE_NONE: "none" - }); - return ConvolveMatrixEffect; -}); +_p[15] = { + value: function(require, exports, module) { + var Effect = _p.r(16), Utils = _p.r(12); + var ConvolveMatrixEffect = _p.r(11).createClass("ConvolveMatrixEffect", { + base: Effect, + constructor: function(edgeMode, input) { + this.callBase(Effect.NAME_CONVOLVE_MATRIX); + this.set("edgeMode", Utils.getValue(edgeMode, ConvolveMatrixEffect.MODE_DUPLICATE)); + this.set("in", Utils.getValue(input, Effect.INPUT_SOURCE_GRAPHIC)); + } + }); + Utils.extend(ConvolveMatrixEffect, { + MODE_DUPLICATE: "duplicate", + MODE_WRAP: "wrap", + MODE_NONE: "none" + }); + return ConvolveMatrixEffect; + } +}; + +//src/filter/effect/effect.js /* * 效果类 * 该类型的对象不存储任何内部属性, 所有操作都是针对该类对象所维护的节点进行的 */ -define("filter/effect/effect", [ "graphic/svg", "core/class", "core/utils" ], function(require, exports, module) { - var svg = require("graphic/svg"), Effect = require("core/class").createClass("Effect", { - constructor: function(type) { - this.node = svg.createNode(type); - }, - getId: function() { - return this.node.id; - }, - setId: function(id) { - this.node.id = id; - return this; - }, - set: function(key, value) { - this.node.setAttribute(key, value); - return this; - }, - get: function(key) { - return this.node.getAttribute(key); - }, - getNode: function() { - return this.node; - }, - // 返回该效果的result - toString: function() { - return this.node.getAttribute("result") || ""; - } - }); - require("core/utils").extend(Effect, { - // 特效名称常量 - NAME_GAUSSIAN_BLUR: "feGaussianBlur", - NAME_OFFSET: "feOffset", - NAME_COMPOSITE: "feComposite", - NAME_COLOR_MATRIX: "feColorMatrix", - NAME_CONVOLVE_MATRIX: "feConvolveMatrix", - // 输入常量 - INPUT_SOURCE_GRAPHIC: "SourceGraphic", - INPUT_SOURCE_ALPHA: "SourceAlpha", - INPUT_BACKGROUND_IMAGE: "BackgroundImage", - INPUT_BACKGROUND_ALPHA: "BackgroundAlpha", - INPUT_FILL_PAINT: "FillPaint", - INPUT_STROKE_PAINT: "StrokePaint" - }); - return Effect; -}); +_p[16] = { + value: function(require, exports, module) { + var svg = _p.r(68), Effect = _p.r(11).createClass("Effect", { + constructor: function(type) { + this.node = svg.createNode(type); + }, + getId: function() { + return this.node.id; + }, + setId: function(id) { + this.node.id = id; + return this; + }, + set: function(key, value) { + this.node.setAttribute(key, value); + return this; + }, + get: function(key) { + return this.node.getAttribute(key); + }, + getNode: function() { + return this.node; + }, + // 返回该效果的result + toString: function() { + return this.node.getAttribute("result") || ""; + } + }); + _p.r(12).extend(Effect, { + // 特效名称常量 + NAME_GAUSSIAN_BLUR: "feGaussianBlur", + NAME_OFFSET: "feOffset", + NAME_COMPOSITE: "feComposite", + NAME_COLOR_MATRIX: "feColorMatrix", + NAME_CONVOLVE_MATRIX: "feConvolveMatrix", + // 输入常量 + INPUT_SOURCE_GRAPHIC: "SourceGraphic", + INPUT_SOURCE_ALPHA: "SourceAlpha", + INPUT_BACKGROUND_IMAGE: "BackgroundImage", + INPUT_BACKGROUND_ALPHA: "BackgroundAlpha", + INPUT_FILL_PAINT: "FillPaint", + INPUT_STROKE_PAINT: "StrokePaint" + }); + return Effect; + } +}; + +//src/filter/effect/gaussianblureffect.js /** * 高斯模糊效果封装 */ -define("filter/effect/gaussianblureffect", [ "filter/effect/effect", "graphic/svg", "core/class", "core/utils" ], function(require, exports, module) { - var Effect = require("filter/effect/effect"), Utils = require("core/utils"); - return require("core/class").createClass("GaussianblurEffect", { - base: Effect, - constructor: function(stdDeviation, input) { - this.callBase(Effect.NAME_GAUSSIAN_BLUR); - this.set("stdDeviation", Utils.getValue(stdDeviation, 1)); - this.set("in", Utils.getValue(input, Effect.INPUT_SOURCE_GRAPHIC)); - } - }); -}); +_p[17] = { + value: function(require, exports, module) { + var Effect = _p.r(16), Utils = _p.r(12); + return _p.r(11).createClass("GaussianblurEffect", { + base: Effect, + constructor: function(stdDeviation, input) { + this.callBase(Effect.NAME_GAUSSIAN_BLUR); + this.set("stdDeviation", Utils.getValue(stdDeviation, 1)); + this.set("in", Utils.getValue(input, Effect.INPUT_SOURCE_GRAPHIC)); + } + }); + } +}; + +//src/filter/effect/offseteffect.js /** * 偏移效果封装 */ -define("filter/effect/offseteffect", [ "filter/effect/effect", "graphic/svg", "core/class", "core/utils" ], function(require, exports, module) { - var Effect = require("filter/effect/effect"), Utils = require("core/utils"); - return require("core/class").createClass("OffsetEffect", { - base: Effect, - constructor: function(dx, dy, input) { - this.callBase(Effect.NAME_OFFSET); - this.set("dx", Utils.getValue(dx, 0)); - this.set("dy", Utils.getValue(dy, 0)); - this.set("in", Utils.getValue(input, Effect.INPUT_SOURCE_GRAPHIC)); - } - }); -}); +_p[18] = { + value: function(require, exports, module) { + var Effect = _p.r(16), Utils = _p.r(12); + return _p.r(11).createClass("OffsetEffect", { + base: Effect, + constructor: function(dx, dy, input) { + this.callBase(Effect.NAME_OFFSET); + this.set("dx", Utils.getValue(dx, 0)); + this.set("dy", Utils.getValue(dy, 0)); + this.set("in", Utils.getValue(input, Effect.INPUT_SOURCE_GRAPHIC)); + } + }); + } +}; + +//src/filter/effectcontainer.js /* * Effect所用的container */ -define("filter/effectcontainer", [ "core/class", "graphic/container" ], function(require) { - return require("core/class").createClass("EffectContainer", { - base: require("graphic/container"), - addEffect: function(point, pos) { - return this.addItem.apply(this, arguments); - }, - prependEffect: function() { - return this.prependItem.apply(this, arguments); - }, - appendEffect: function() { - return this.appendItem.apply(this, arguments); - }, - removeEffect: function(pos) { - return this.removeItem.apply(this, arguments); - }, - addEffects: function() { - return this.addItems.apply(this, arguments); - }, - setEffects: function() { - return this.setItems.apply(this, arguments); - }, - getEffect: function() { - return this.getItem.apply(this, arguments); - }, - getEffects: function() { - return this.getItems.apply(this, arguments); - }, - getFirstEffect: function() { - return this.getFirstItem.apply(this, arguments); - }, - getLastEffect: function() { - return this.getLastItem.apply(this, arguments); - }, - handleAdd: function(effectItem, pos) { - var count = this.getEffects().length, nextEffectItem = this.getItem(pos + 1); - // 最后一个节点, 直接追加 - if (count === pos + 1) { - this.node.appendChild(effectItem.getNode()); - return; +_p[19] = { + value: function(require) { + return _p.r(11).createClass("EffectContainer", { + base: _p.r(29), + addEffect: function(point, pos) { + return this.addItem.apply(this, arguments); + }, + prependEffect: function() { + return this.prependItem.apply(this, arguments); + }, + appendEffect: function() { + return this.appendItem.apply(this, arguments); + }, + removeEffect: function(pos) { + return this.removeItem.apply(this, arguments); + }, + addEffects: function() { + return this.addItems.apply(this, arguments); + }, + setEffects: function() { + return this.setItems.apply(this, arguments); + }, + getEffect: function() { + return this.getItem.apply(this, arguments); + }, + getEffects: function() { + return this.getItems.apply(this, arguments); + }, + getFirstEffect: function() { + return this.getFirstItem.apply(this, arguments); + }, + getLastEffect: function() { + return this.getLastItem.apply(this, arguments); + }, + handleAdd: function(effectItem, pos) { + var count = this.getEffects().length, nextEffectItem = this.getItem(pos + 1); + // 最后一个节点, 直接追加 + if (count === pos + 1) { + this.node.appendChild(effectItem.getNode()); + return; + } + this.node.insertBefore(effectItem.getNode(), nextEffectItem.getNode()); } - this.node.insertBefore(effectItem.getNode(), nextEffectItem.getNode()); - } - }); -}); + }); + } +}; + +//src/filter/filter.js /** * Filter 基类 */ -define("filter/filter", [ "graphic/svg", "core/class", "filter/effectcontainer", "graphic/container", "graphic/shape", "core/utils", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box" ], function(require, exports, module) { - var svg = require("graphic/svg"); - var Class = require("core/class"); - var Filter = Class.createClass("Filter", { - mixins: [ require("filter/effectcontainer") ], - constructor: function(x, y, width, height) { - this.node = svg.createNode("filter"); - if (x !== undefined) { - this.set("x", x); - } - if (y !== undefined) { - this.set("y", y); - } - if (width !== undefined) { - this.set("width", width); - } - if (height !== undefined) { - this.set("height", height); +_p[20] = { + value: function(require, exports, module) { + var svg = _p.r(68); + var Class = _p.r(11); + var Filter = Class.createClass("Filter", { + mixins: [ _p.r(19) ], + constructor: function(x, y, width, height) { + this.node = svg.createNode("filter"); + if (x !== undefined) { + this.set("x", x); + } + if (y !== undefined) { + this.set("y", y); + } + if (width !== undefined) { + this.set("width", width); + } + if (height !== undefined) { + this.set("height", height); + } + }, + getId: function() { + return this.id; + }, + setId: function(id) { + this.node.id = id; + return this; + }, + set: function(key, value) { + this.node.setAttribute(key, value); + return this; + }, + get: function(key) { + return this.node.getAttribute(key); + }, + getNode: function() { + return this.node; } - }, - getId: function() { - return this.id; - }, - setId: function(id) { - this.node.id = id; - return this; - }, - set: function(key, value) { - this.node.setAttribute(key, value); - return this; - }, - get: function(key) { - return this.node.getAttribute(key); - }, - getNode: function() { - return this.node; - } - }); - var Shape = require("graphic/shape"); - Class.extendClass(Shape, { - applyFilter: function(filter) { - var filterId = filter.get("id"); - if (filterId) { - this.node.setAttribute("filter", "url(#" + filterId + ")"); + }); + var Shape = _p.r(61); + Class.extendClass(Shape, { + applyFilter: function(filter) { + var filterId = filter.get("id"); + if (filterId) { + this.node.setAttribute("filter", "url(#" + filterId + ")"); + } + return this; } - return this; - } - }); - return Filter; -}); + }); + return Filter; + } +}; + +//src/filter/gaussianblurfilter.js /* * 高斯模糊滤镜 */ -define("filter/gaussianblurfilter", [ "filter/effect/gaussianblureffect", "filter/effect/effect", "core/utils", "core/class", "filter/filter", "graphic/svg", "filter/effectcontainer", "graphic/shape" ], function(require, exports, module) { - var GaussianblurEffect = require("filter/effect/gaussianblureffect"); - return require("core/class").createClass("GaussianblurFilter", { - base: require("filter/filter"), - constructor: function(stdDeviation) { - this.callBase(); - this.addEffect(new GaussianblurEffect(stdDeviation)); - } - }); -}); +_p[21] = { + value: function(require, exports, module) { + var GaussianblurEffect = _p.r(17); + return _p.r(11).createClass("GaussianblurFilter", { + base: _p.r(20), + constructor: function(stdDeviation) { + this.callBase(); + this.addEffect(new GaussianblurEffect(stdDeviation)); + } + }); + } +}; + +//src/filter/projectionfilter.js /* * 投影滤镜 */ -define("filter/projectionfilter", [ "filter/effect/gaussianblureffect", "filter/effect/effect", "core/utils", "core/class", "graphic/svg", "filter/effect/colormatrixeffect", "graphic/color", "graphic/standardcolor", "filter/effect/compositeeffect", "filter/effect/offseteffect", "filter/filter", "filter/effectcontainer", "graphic/shape" ], function(require, exports, module) { - var GaussianblurEffect = require("filter/effect/gaussianblureffect"), Effect = require("filter/effect/effect"), ColorMatrixEffect = require("filter/effect/colormatrixeffect"), Color = require("graphic/color"), Utils = require("core/utils"), CompositeEffect = require("filter/effect/compositeeffect"), OffsetEffect = require("filter/effect/offseteffect"); - return require("core/class").createClass("ProjectionFilter", { - base: require("filter/filter"), - constructor: function(stdDeviation, dx, dy) { - this.callBase(); - this.gaussianblurEffect = new GaussianblurEffect(stdDeviation, Effect.INPUT_SOURCE_ALPHA); - this.gaussianblurEffect.set("result", "gaussianblur"); - this.addEffect(this.gaussianblurEffect); - this.offsetEffect = new OffsetEffect(dx, dy, this.gaussianblurEffect); - this.offsetEffect.set("result", "offsetBlur"); - this.addEffect(this.offsetEffect); - this.colorMatrixEffect = new ColorMatrixEffect(ColorMatrixEffect.TYPE_MATRIX, this.offsetEffect); - this.colorMatrixEffect.set("values", ColorMatrixEffect.MATRIX_ORIGINAL); - this.colorMatrixEffect.set("result", "colorOffsetBlur"); - this.addEffect(this.colorMatrixEffect); - this.compositeEffect = new CompositeEffect(CompositeEffect.OPERATOR_OVER, Effect.INPUT_SOURCE_GRAPHIC, this.colorMatrixEffect); - this.addEffect(this.compositeEffect); - }, - // 设置投影颜色 - setColor: function(color) { - var matrix = null, originMatrix = null, colorValue = []; - if (Utils.isString(color)) { - color = Color.parse(color); - } - if (!color) { +_p[22] = { + value: function(require, exports, module) { + var GaussianblurEffect = _p.r(17), Effect = _p.r(16), ColorMatrixEffect = _p.r(13), Color = _p.r(28), Utils = _p.r(12), CompositeEffect = _p.r(14), OffsetEffect = _p.r(18); + return _p.r(11).createClass("ProjectionFilter", { + base: _p.r(20), + constructor: function(stdDeviation, dx, dy) { + this.callBase(); + this.gaussianblurEffect = new GaussianblurEffect(stdDeviation, Effect.INPUT_SOURCE_ALPHA); + this.gaussianblurEffect.set("result", "gaussianblur"); + this.addEffect(this.gaussianblurEffect); + this.offsetEffect = new OffsetEffect(dx, dy, this.gaussianblurEffect); + this.offsetEffect.set("result", "offsetBlur"); + this.addEffect(this.offsetEffect); + this.colorMatrixEffect = new ColorMatrixEffect(ColorMatrixEffect.TYPE_MATRIX, this.offsetEffect); + this.colorMatrixEffect.set("values", ColorMatrixEffect.MATRIX_ORIGINAL); + this.colorMatrixEffect.set("result", "colorOffsetBlur"); + this.addEffect(this.colorMatrixEffect); + this.compositeEffect = new CompositeEffect(CompositeEffect.OPERATOR_OVER, Effect.INPUT_SOURCE_GRAPHIC, this.colorMatrixEffect); + this.addEffect(this.compositeEffect); + }, + // 设置投影颜色 + setColor: function(color) { + var matrix = null, originMatrix = null, colorValue = []; + if (Utils.isString(color)) { + color = Color.parse(color); + } + if (!color) { + return this; + } + matrix = ColorMatrixEffect.MATRIX_EMPTY.split(" "); + colorValue.push(color.get("r")); + colorValue.push(color.get("g")); + colorValue.push(color.get("b")); + // rgb 分量更改 + for (var i = 0, len = colorValue.length; i < len; i++) { + matrix[i * 5 + 3] = colorValue[i] / 255; + } + // alpha 分量更改 + matrix[18] = color.get("a"); + this.colorMatrixEffect.set("values", matrix.join(" ")); + return this; + }, + // 设置投影透明度 + setOpacity: function(opacity) { + var matrix = this.colorMatrixEffect.get("values").split(" "); + matrix[18] = opacity; + this.colorMatrixEffect.set("values", matrix.join(" ")); return this; + }, + // 设置阴影偏移量 + setOffset: function(dx, dy) { + this.setOffsetX(dx); + this.setOffsetY(dy); + }, + setOffsetX: function(dx) { + this.offsetEffect.set("dx", dx); + }, + setOffsetY: function(dy) { + this.offsetEffect.set("dy", dy); + }, + setDeviation: function(deviation) { + this.gaussianblurEffect.set("stdDeviation", deviation); } - matrix = ColorMatrixEffect.MATRIX_EMPTY.split(" "); - colorValue.push(color.get("r")); - colorValue.push(color.get("g")); - colorValue.push(color.get("b")); - // rgb 分量更改 - for (var i = 0, len = colorValue.length; i < len; i++) { - matrix[i * 5 + 3] = colorValue[i] / 255; - } - // alpha 分量更改 - matrix[18] = color.get("a"); - this.colorMatrixEffect.set("values", matrix.join(" ")); - return this; - }, - // 设置投影透明度 - setOpacity: function(opacity) { - var matrix = this.colorMatrixEffect.get("values").split(" "); - matrix[18] = opacity; - this.colorMatrixEffect.set("values", matrix.join(" ")); - return this; - }, - // 设置阴影偏移量 - setOffset: function(dx, dy) { - this.setOffsetX(dx); - this.setOffsetY(dy); - }, - setOffsetX: function(dx) { - this.offsetEffect.set("dx", dx); - }, - setOffsetY: function(dy) { - this.offsetEffect.set("dy", dy); - }, - setDeviation: function(deviation) { - this.gaussianblurEffect.set("stdDeviation", deviation); - } - }); -}); + }); + } +}; + +//src/graphic/bezier.js /** * @fileOverview * * 贝塞尔曲线 */ -define("graphic/bezier", [ "core/class", "graphic/pointcontainer", "graphic/container", "graphic/path", "core/utils", "graphic/shape", "graphic/svg", "graphic/geometry" ], function(require, exports, module) { - /** +_p[23] = { + value: function(require, exports, module) { + /** * @class kity.Bezier * @mixins kity.PointContainer * @base kity.Path @@ -2584,10 +2661,10 @@ define("graphic/bezier", [ "core/class", "graphic/pointcontainer", "graphic/cont * ]); * ``` */ - return require("core/class").createClass("Bezier", { - mixins: [ require("graphic/pointcontainer") ], - base: require("graphic/path"), - /** + return _p.r(11).createClass("Bezier", { + mixins: [ _p.r(52) ], + base: _p.r(47), + /** * @constructor * @for kity.Bezier * @@ -2595,13 +2672,13 @@ define("graphic/bezier", [ "core/class", "graphic/pointcontainer", "graphic/cont * * @param {kity.BezierPoints[]} bezierPoints 贝塞尔点集合,每个元素应该是 {kity.BezierPoint} 类型 */ - constructor: function(bezierPoints) { - this.callBase(); - bezierPoints = bezierPoints || []; - this.changeable = true; - this.setBezierPoints(bezierPoints); - }, - /** + constructor: function(bezierPoints) { + this.callBase(); + bezierPoints = bezierPoints || []; + this.changeable = true; + this.setBezierPoints(bezierPoints); + }, + /** * @method getBezierPoints() * @for kity.Bezier * @description 返回当前贝塞尔曲线的贝塞尔点集合 @@ -2609,10 +2686,10 @@ define("graphic/bezier", [ "core/class", "graphic/pointcontainer", "graphic/cont * @grammar getBezierPoints() => {kity.BezierPoints[]} * */ - getBezierPoints: function() { - return this.getPoints(); - }, - /** + getBezierPoints: function() { + return this.getPoints(); + }, + /** * @method setBezierPoints() * @for kity.Bezier * @description 设置当前贝塞尔曲线的贝塞尔点集合 @@ -2621,266 +2698,406 @@ define("graphic/bezier", [ "core/class", "graphic/pointcontainer", "graphic/cont * * @param {kity.BezierPoint[]} bezierPoints 贝塞尔点集合 */ - setBezierPoints: function(bezierPoints) { - return this.setPoints(bezierPoints); - }, - //当点集合发生变化时采取的动作 - onContainerChanged: function() { - if (this.changeable) { - this.update(); - } - }, - update: function() { - var drawer = null, bezierPoints = this.getBezierPoints(); - //单独的一个点不画任何图形 - if (bezierPoints.length < 2) { - return; - } - drawer = this.getDrawer(); - drawer.clear(); - var vertex = bezierPoints[0].getVertex(), forward = null, backward = null; - drawer.moveTo(vertex.x, vertex.y); - for (var i = 1, len = bezierPoints.length; i < len; i++) { - vertex = bezierPoints[i].getVertex(); - backward = bezierPoints[i].getBackward(); - forward = bezierPoints[i - 1].getForward(); - drawer.bezierTo(forward.x, forward.y, backward.x, backward.y, vertex.x, vertex.y); + setBezierPoints: function(bezierPoints) { + return this.setPoints(bezierPoints); + }, + //当点集合发生变化时采取的动作 + onContainerChanged: function() { + if (this.changeable) { + this.update(); + } + }, + update: function() { + var drawer = null, bezierPoints = this.getBezierPoints(); + //单独的一个点不画任何图形 + if (bezierPoints.length < 2) { + return; + } + drawer = this.getDrawer(); + drawer.clear(); + var vertex = bezierPoints[0].getVertex(), forward = null, backward = null; + drawer.moveTo(vertex.x, vertex.y); + for (var i = 1, len = bezierPoints.length; i < len; i++) { + vertex = bezierPoints[i].getVertex(); + backward = bezierPoints[i].getBackward(); + forward = bezierPoints[i - 1].getForward(); + drawer.bezierTo(forward.x, forward.y, backward.x, backward.y, vertex.x, vertex.y); + } + return this; } - return this; - } - }); -}); + }); + } +}; + +//src/graphic/bezierpoint.js /** * @fileOverview * * 表示一个贝塞尔点 */ -define("graphic/bezierpoint", [ "graphic/shapepoint", "core/class", "graphic/point", "graphic/vector", "graphic/matrix" ], function(require, exports, module) { - var ShapePoint = require("graphic/shapepoint"); - var Vector = require("graphic/vector"); - /** +_p[24] = { + value: function(require, exports, module) { + var ShapePoint = _p.r(64); + var Vector = _p.r(74); + /** * @class kity.BezierPoint + * + * @description 表示一个贝塞尔点 + * 一个贝塞尔点由顶点坐标(曲线经过的点)、前方控制点、后方控制点表示 */ - var BezierPoint = require("core/class").createClass("BezierPoint", { - constructor: function(x, y, isSmooth) { - //顶点 - this.vertex = new ShapePoint(x, y); - //控制点 - this.forward = new ShapePoint(x, y); - this.backward = new ShapePoint(x, y); - //是否平滑 - this.setSmooth(isSmooth === undefined || isSmooth); - this.setSymReflaction(true); - }, - clone: function() { - var newPoint = new BezierPoint(), tmp = null; - tmp = this.getVertex(); - newPoint.setVertex(tmp.x, tmp.y); - tmp = this.getForward(); - newPoint.setForward(tmp.x, tmp.y); - tmp = this.getBackward(); - newPoint.setBackward(tmp.x, tmp.y); - newPoint.setSmooth(newPoint.isSmooth()); - return newPoint; - }, - setVertex: function(x, y) { - this.vertex.setPoint(x, y); - this.update(); - return this; - }, - moveTo: function(x, y) { - var oldForward = this.forward.getPoint(), oldBackward = this.backward.getPoint(), oldVertex = this.vertex.getPoint(), //移动距离 - distance = { - left: x - oldVertex.x, - top: y - oldVertex.y - }; - // 更新 - this.forward.setPoint(oldForward.x + distance.left, oldForward.y + distance.top); - this.backward.setPoint(oldBackward.x + distance.left, oldBackward.y + distance.top); - this.vertex.setPoint(x, y); - this.update(); - }, - setForward: function(x, y) { - this.forward.setPoint(x, y); - //更新后置点 - if (this.smooth) { - this.updateAnother(this.forward, this.backward); - } - this.update(); - return this; - }, - setBackward: function(x, y) { - this.backward.setPoint(x, y); - //更新前置点 - if (this.smooth) { - this.updateAnother(this.backward, this.forward); - } - this.update(); - return this; - }, - setSymReflaction: function(value) { - this.symReflaction = value; - }, - isSymReflaction: function() { - return this.symReflaction; - }, - updateAnother: function(p, q) { - var v = this.getVertex(), pv = Vector.fromPoints(p.getPoint(), v), vq = Vector.fromPoints(v, q.getPoint()); - vq = pv.normalize(this.isSymReflaction() ? pv.length() : vq.length()); - q.setPoint(v.x + vq.x, v.y + vq.y); - }, - setSmooth: function(isSmooth) { - this.smooth = !!isSmooth; - return this; - }, - getVertex: function() { - return this.vertex.getPoint(); - }, - getForward: function() { - return this.forward.getPoint(); - }, - getBackward: function() { - return this.backward.getPoint(); - }, - isSmooth: function() { - return this.smooth; - }, - update: function() { - if (!this.container) { - return this; - } - //新增参数 this, 把当前引起变化的点传递过去, 以便有需要的地方可以获取到引起变化的源 - if (this.container.update) this.container.update(this); - } - }); - return BezierPoint; -}); -/** - * @fileOverview - * - * 表示一个矩形区域 - */ -define("graphic/box", [ "core/class" ], function(require, exports, module) { - /** - * @class kity.Box - * @description 表示一个矩形区域 - */ - var Box = require("core/class").createClass("Box", { - /** + var BezierPoint = _p.r(11).createClass("BezierPoint", { + /** * @constructor - * @for kity.Box + * @for kity.BezierPoint * - * @grammar new kity.Box(x, y, width, height) - * @grammar new kity.Box(value) + * @description 创建一个具有默认顶点坐标的贝塞尔点,两个控制点的坐标和顶点一致 * - * @param {Number} x|value.x 矩形区域的 x 坐标 - * @param {Number} y|value.y 矩形区域的 y 坐标 - * @param {Number} width|value.width 矩形区域的宽度 - * @param {Number} height|value.height 矩形区域的高度 + * @param {Number} x 顶点的 x 坐标 + * @param {Number} y 顶点的 y 坐标 + * @param {Boolean} isSmooth 指示当前贝塞尔点是否光滑,光滑会约束顶点和两个控制点共线 + */ + constructor: function(x, y, isSmooth) { + //顶点 + this.vertex = new ShapePoint(x, y); + //控制点 + this.forward = new ShapePoint(x, y); + this.backward = new ShapePoint(x, y); + //是否平滑 + this.setSmooth(isSmooth === undefined || isSmooth); + this.setSymReflaction(true); + }, + /** + * @method clone() + * @for kity.BezierPoint + * @description 返回贝塞尔点的一份拷贝 * - * @example + * @grammar clone() => {kity.BezierPoint} + */ + clone: function() { + var newPoint = new BezierPoint(), tmp = null; + tmp = this.getVertex(); + newPoint.setVertex(tmp.x, tmp.y); + tmp = this.getForward(); + newPoint.setForward(tmp.x, tmp.y); + tmp = this.getBackward(); + newPoint.setBackward(tmp.x, tmp.y); + newPoint.setSymReflaction(this.isSymReflaction); + newPoint.setSmooth(this.isSmooth()); + return newPoint; + }, + /** + * @method setVertex() + * @for kity.BezierPoint + * @description 设置贝塞尔点的顶点坐标,注意,控制点的坐标不会跟着变化。希望控制点的坐标跟着变化,请用 moveTo() 方法 * - * ```js + * @grammar setVertex(x, y) => {this} + * + * @param {Number} x 顶点的 x 坐标 + * @param {Number} y 顶点的 y 坐标 + */ + setVertex: function(x, y) { + this.vertex.setPoint(x, y); + this.update(); + return this; + }, + /** + * @method moveTo() + * @for kity.BezierPoint + * @description 同步移动整个贝塞尔点,使顶点的移动到指定的坐标中。控制点的位置相对顶点坐标固定。 + * + * @grammar moveTo() => {this} + * + * @param {Number} x 顶点的目标 x 坐标 + * @param {Number} y 顶点的目标 y 坐标 + * + */ + moveTo: function(x, y) { + var oldForward = this.forward.getPoint(), oldBackward = this.backward.getPoint(), oldVertex = this.vertex.getPoint(), //移动距离 + distance = { + left: x - oldVertex.x, + top: y - oldVertex.y + }; + // 更新 + this.forward.setPoint(oldForward.x + distance.left, oldForward.y + distance.top); + this.backward.setPoint(oldBackward.x + distance.left, oldBackward.y + distance.top); + this.vertex.setPoint(x, y); + this.update(); + }, + /** + * @method setForward() + * @for kity.BezierPoint + * @description 设置前方控制点的位置,如果贝塞尔点光滑,后方控制点会跟着联动 + * + * @grammar setForward(x, y) => {this} + * + * @param {Number} x 前方控制点的 x 坐标 + * @param {Number} y 前方控制点的 y 坐标 + */ + setForward: function(x, y) { + this.forward.setPoint(x, y); + //更新后置点 + if (this.smooth) { + this.updateAnother(this.forward, this.backward); + } + this.update(); + this.lastControlPointSet = this.forward; + return this; + }, + /** + * @method setBackward() + * @for kity.BezierPoint + * @description 设置后方控制点的位置,如果贝塞尔点光滑,前方控制点会跟着联动 + * + * @grammar setBackward(x, y) => {this} + * + * @param {Number} x 后方控制点的 x 坐标 + * @param {Number} y 后方控制点的 y 坐标 + */ + setBackward: function(x, y) { + this.backward.setPoint(x, y); + //更新前置点 + if (this.smooth) { + this.updateAnother(this.backward, this.forward); + } + this.update(); + this.lastControlPointSet = this.backward; + return this; + }, + /** + * @method setSymReflaction() + * @for kity.BezierPoint + * @description 设定是否镜像两个控制点的位置 + * + * @grammar setSymReflaction(value) => {this} + * + * @param {boolean} value 如果设置为 true,且贝塞尔点光滑,两个控制点离顶点的距离相等 + */ + setSymReflaction: function(value) { + this.symReflaction = value; + if (this.smooth) this.setSmooth(true); + return this; + }, + /** + * @method isSymReflaction() + * @for kity.BezierPoint + * @description 当前贝塞尔点的两个控制点是否被镜像约束 + * + * @grammar isSymReflaction() => {boolean} + */ + isSymReflaction: function() { + return this.symReflaction; + }, + /** + * @private + * + * 根据前方控制点或后方控制点更新另一方 + */ + updateAnother: function(p, q) { + var v = this.getVertex(), pv = Vector.fromPoints(p.getPoint(), v), vq = Vector.fromPoints(v, q.getPoint()); + vq = pv.normalize(this.isSymReflaction() ? pv.length() : vq.length()); + q.setPoint(v.x + vq.x, v.y + vq.y); + return this; + }, + /** + * @method setSmooth() + * @for kity.BezierPoint + * @description 设置贝塞尔点是否光滑,光滑会约束顶点和两个控制点共线 + * + * @param {Boolean} isSmooth 设置为 true 让贝塞尔点光滑 + */ + setSmooth: function(isSmooth) { + var lc; + this.smooth = !!isSmooth; + if (this.smooth && (lc = this.lastControlPointSet)) { + this.updateAnother(lc, lc == this.forward ? this.backward : this.forward); + } + return this; + }, + /** + * @method isSmooth() + * @for kity.BezierPoint + * @description 判断贝塞尔点是否光滑 + * + * @grammar isSmooth() => {boolean} + */ + isSmooth: function() { + return this.smooth; + }, + /** + * @method getVertex() + * @for kity.BezierPoint + * @description 获得当前贝塞尔点的顶点 + * + * @grammar getVertex() => {kity.ShapePoint} + */ + getVertex: function() { + return this.vertex.getPoint(); + }, + /** + * @method getForward() + * @for kity.BezierPoint + * @description 获得当前贝塞尔点的前方控制点 + * + * @grammar getForward() => {kity.ShapePoint} + */ + getForward: function() { + return this.forward.getPoint(); + }, + /** + * @method getBackward() + * @for kity.BezierPoint + * @description 获得当前贝塞尔点的后方控制点 + * + * @grammar getBackward() => {kity.ShapePoint} + */ + getBackward: function() { + return this.backward.getPoint(); + }, + /** + * @private + * + * 联动更新相关的贝塞尔曲线 + */ + update: function() { + if (!this.container) { + return this; + } + //新增参数 this, 把当前引起变化的点传递过去, 以便有需要的地方可以获取到引起变化的源 + if (this.container.update) this.container.update(this); + } + }); + return BezierPoint; + } +}; + +//src/graphic/box.js +/** + * @fileOverview + * + * 表示一个矩形区域 + */ +_p[25] = { + value: function(require, exports, module) { + /** + * @class kity.Box + * @description 表示一个矩形区域 + */ + var Box = _p.r(11).createClass("Box", { + /** + * @constructor + * @for kity.Box + * + * @grammar new kity.Box(x, y, width, height) + * @grammar new kity.Box(value) + * + * @param {Number} x|value.x 矩形区域的 x 坐标 + * @param {Number} y|value.y 矩形区域的 y 坐标 + * @param {Number} width|value.width 矩形区域的宽度 + * @param {Number} height|value.height 矩形区域的高度 + * + * @example + * + * ```js * var box = new kity.Box(10, 20, 50, 50); * var box2 = new kity.Box({x: 10, y: 20, width: 50, height: 50}); * ``` */ - constructor: function(x, y, width, height) { - var box = arguments[0]; - if (box && typeof box === "object") { - x = box.x; - y = box.y; - width = box.width; - height = box.height; - } - if (width < 0) { - x -= width = -width; - } - if (height < 0) { - y -= height = -height; - } - /** + constructor: function(x, y, width, height) { + var box = arguments[0]; + if (box && typeof box === "object") { + x = box.x; + y = box.y; + width = box.width; + height = box.height; + } + if (width < 0) { + x -= width = -width; + } + if (height < 0) { + y -= height = -height; + } + /** * @property x * @for kity.Box * @type {Number} * @readOnly * @description 矩形区域的 x 坐标 */ - this.x = x || 0; - /** + this.x = x || 0; + /** * @property y * @for kity.Box * @type {Number} * @readOnly * @description 矩形区域的 y 坐标 */ - this.y = y || 0; - /** + this.y = y || 0; + /** * @property width * @for kity.Box * @type {Number} * @readOnly * @description 矩形区域的宽度 */ - this.width = width || 0; - /** + this.width = width || 0; + /** * @property height * @for kity.Box * @type {Number} * @readOnly * @description 矩形区域的高度 */ - this.height = height || 0; - /** + this.height = height || 0; + /** * @property left * @for kity.Box * @type {Number} * @readOnly * @description 矩形区域的最左侧坐标,等价于 x 的值 */ - this.left = this.x; - /** + this.left = this.x; + /** * @property right * @for kity.Box * @type {Number} * @readOnly * @description 矩形区域的最右侧坐标,等价于 x + width 的值 */ - this.right = this.x + this.width; - /** + this.right = this.x + this.width; + /** * @property top * @for kity.Box * @type {Number} * @readOnly * @description 矩形区域的最上侧坐标,等价于 y 的值 */ - this.top = this.y; - /** + this.top = this.y; + /** * @property bottom * @for kity.Box * @type {Number} * @readOnly * @description 矩形区域的最下侧坐标,等价于 y + height 的值 */ - this.bottom = this.y + this.height; - /** + this.bottom = this.y + this.height; + /** * @property cx * @for kity.Box * @type {Number} * @readOnly * @description 矩形区域的中心 x 坐标 */ - this.cx = this.x + this.width / 2; - /** + this.cx = this.x + this.width / 2; + /** * @property cy * @for kity.Box * @type {Number} * @readOnly * @description 矩形区域的中心 y 坐标 */ - this.cy = this.y + this.height / 2; - }, - /** + this.cy = this.y + this.height / 2; + }, + /** * @method getRangeX() * @for kity.Box * @description 获得矩形区域的 x 值域 @@ -2892,10 +3109,10 @@ define("graphic/box", [ "core/class" ], function(require, exports, module) { * var box = new kity.Box(10, 10, 30, 50); * console.log(box.getRangeX()); // [10, 40] */ - getRangeX: function() { - return [ this.left, this.right ]; - }, - /** + getRangeX: function() { + return [ this.left, this.right ]; + }, + /** * @method getRangeY() * @for kity.Box * @description 获得矩形区域的 y 值域 @@ -2907,10 +3124,10 @@ define("graphic/box", [ "core/class" ], function(require, exports, module) { * var box = new kity.Box(10, 10, 30, 50); * console.log(box.getRangeY()); // [10, 60] */ - getRangeY: function() { - return [ this.top, this.bottom ]; - }, - /** + getRangeY: function() { + return [ this.top, this.bottom ]; + }, + /** * @method merge() * @for kity.Box * @description 把当前矩形区域和指定的矩形区域合并,返回一个新的矩形区域(即包含两个源矩形区域的最小矩形区域) @@ -2927,11 +3144,11 @@ define("graphic/box", [ "core/class" ], function(require, exports, module) { * console.log(box3.valueOf()); // [10, 10, 70, 70] * ``` */ - merge: function(another) { - var left = Math.min(this.left, another.left), right = Math.max(this.right, another.right), top = Math.min(this.top, another.top), bottom = Math.max(this.bottom, another.bottom); - return new Box(left, top, right - left, bottom - top); - }, - /** + merge: function(another) { + var left = Math.min(this.left, another.left), right = Math.max(this.right, another.right), top = Math.min(this.top, another.top), bottom = Math.max(this.bottom, another.bottom); + return new Box(left, top, right - left, bottom - top); + }, + /** * @method expand() * @for kity.Box * @description 扩展(或收缩)当前的盒子,返回新的盒子 @@ -2963,23 +3180,23 @@ define("graphic/box", [ "core/class" ], function(require, exports, module) { * var box3 = box.expand(1, 2, 3, 4); // [9, 8, 24, 26] * ``` */ - expand: function(top, right, bottom, left) { - if (arguments.length < 1) { - return new Box(this); - } - if (arguments.length < 2) { - right = top; - } - if (arguments.length < 3) { - bottom = top; - } - if (arguments.length < 4) { - left = right; - } - var x = this.left - left, y = this.top - top, width = this.width + right, height = this.height + top; - return new Box(x, y, width, height); - }, - /** + expand: function(top, right, bottom, left) { + if (arguments.length < 1) { + return new Box(this); + } + if (arguments.length < 2) { + right = top; + } + if (arguments.length < 3) { + bottom = top; + } + if (arguments.length < 4) { + left = right; + } + var x = this.left - left, y = this.top - top, width = this.width + right, height = this.height + top; + return new Box(x, y, width, height); + }, + /** * @method valueOf() * @for kity.Box * @description 返回当前盒子的数组表示 @@ -2993,10 +3210,10 @@ define("graphic/box", [ "core/class" ], function(require, exports, module) { * console.log(box.valueOf()); // [0, 0, 200, 50] * ``` */ - valueOf: function() { - return [ this.x, this.y, this.width, this.height ]; - }, - /** + valueOf: function() { + return [ this.x, this.y, this.width, this.height ]; + }, + /** * @method toString() * @for kity.Box * @description 返回当前盒子的字符串表示 @@ -3009,11 +3226,11 @@ define("graphic/box", [ "core/class" ], function(require, exports, module) { * var box = new kity.Box(0, 0, 200, 50); * console.log(box.toString()); // "0 0 200 50" */ - toString: function() { - return this.valueOf().join(" "); - } - }); - /** + toString: function() { + return this.valueOf().join(" "); + } + }); + /** * @method parse() * @static * @for kity.Box @@ -3030,1063 +3247,1111 @@ define("graphic/box", [ "core/class" ], function(require, exports, module) { * console.log(kity.Box.parse([0, 0, 100, 200])); * ``` */ - Box.parse = function(any) { - if (typeof any == "string") { - return Box.parse(any.split(/[\s,]+/).map(parseFloat)); - } - if (any instanceof Array) { - return new Box(any[0], any[1], any[2], any[3]); - } - if ("x" in any) return new Box(any); - return null; - }; - return Box; -}); + Box.parse = function(any) { + if (typeof any == "string") { + return Box.parse(any.split(/[\s,]+/).map(parseFloat)); + } + if (any instanceof Array) { + return new Box(any[0], any[1], any[2], any[3]); + } + if ("x" in any) return new Box(any); + return null; + }; + return Box; + } +}; + +//src/graphic/circle.js /** * @fileOverview * * 绘制和使用圆形 */ -define("graphic/circle", [ "core/class", "graphic/ellipse", "core/utils", "graphic/point", "graphic/path" ], function(require, exports, module) { - /** +_p[26] = { + value: function(require, exports, module) { + /** * @class kity.Circle * @base kity.Ellipse * @description 表示一个圆形 */ - return require("core/class").createClass("Circle", { - base: require("graphic/ellipse"), - /** + return _p.r(11).createClass("Circle", { + base: _p.r(33), + /** * @constructor * @for kity.Circle * - * @param {[type]} radius [description] - * @param {[type]} cx [description] - * @param {[type]} cy [description] - * - * @return {[type]} [description] + * @param {Number} radius 半径 + * @param {Number} cx 圆心 x 坐标 + * @param {Number} cy 圆心 y 坐标 */ - constructor: function(radius, cx, cy) { - this.callBase(radius, radius, cx, cy); - }, - getRadius: function() { - return this.getRadiusX(); - }, - setRadius: function(radius) { - return this.callBase(radius, radius); - } - }); -}); -define("graphic/clip", [ "core/class", "graphic/shape", "graphic/svg", "core/utils", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box", "graphic/shapecontainer", "graphic/container" ], function(require, exports, module) { - var Class = require("core/class"); - var Shape = require("graphic/shape"); - var Clip = Class.createClass("Clip", { - base: Shape, - mixins: [ require("graphic/shapecontainer") ], - constructor: function() { - this.callBase("clipPath"); - }, - clip: function(shape) { - shape.getNode().setAttribute("clip-path", "url(#" + this.getId() + ")"); - return this; - } - }); - Class.extendClass(Shape, { - clipWith: function(clip) { - clip.clip(this); - return this; - } - }); - return Clip; -}); -define("graphic/color", [ "core/utils", "graphic/standardcolor", "core/class" ], function(require, exports, module) { - var Utils = require("core/utils"), StandardColor = require("graphic/standardcolor"), ColorUtils = {}, Color = require("core/class").createClass("Color", { - constructor: function() { - var colorValue = null; - //parse构造 - if (typeof arguments[0] === "string") { - colorValue = ColorUtils.parseToValue(arguments[0]); - //解析失败 - if (colorValue === null) { - colorValue = { - r: 0, - g: 0, - b: 0, - h: 0, - s: 0, - l: 0, - a: 1 - }; - } - } else { - colorValue = { - r: arguments[0] | 0, - g: arguments[1] | 0, - b: arguments[2] | 0, - //alpha 默认为1 - a: parseFloat(arguments[3]) || 1 - }; - colorValue = ColorUtils.overflowFormat(colorValue); - //获取hsl分量 - colorValue = Utils.extend(colorValue, ColorUtils.rgbValueToHslValue(colorValue)); - } - this._color = colorValue; - }, - set: function(name, value) { - var values = null; - //设置的值非法 - if (!Color._MAX_VALUE[name]) { - throw new Error("Color set(): Illegal parameter"); + constructor: function(radius, cx, cy) { + this.callBase(radius, radius, cx, cy); + }, + /** + * @method + * @for kity.Circle + * @description 获取原型的半径 + */ + getRadius: function() { + return this.getRadiusX(); + }, + setRadius: function(radius) { + return this.callBase(radius, radius); } - if (name !== "a") { - value = Math.floor(value); + }); + } +}; + +//src/graphic/clip.js +/** + * @fileOverview + * + * 支持图形剪辑 + */ +_p[27] = { + value: function(require, exports, module) { + var Class = _p.r(11); + var Shape = _p.r(61); + var Clip = Class.createClass("Clip", { + base: Shape, + mixins: [ _p.r(62) ], + constructor: function() { + this.callBase("clipPath"); + }, + clip: function(shape) { + shape.getNode().setAttribute("clip-path", "url(#" + this.getId() + ")"); + return this; } - if (name == "h") { - value = (value + 360) % 360; + }); + Class.extendClass(Shape, { + clipWith: function(clip) { + clip.clip(this); + return this; } - this._color[name] = Math.max(Color._MIN_VALUE[name], Math.min(Color._MAX_VALUE[name], value)); - if ("rgb".indexOf(name) !== -1) { - this._color = Utils.extend(this._color, ColorUtils.rgbValueToHslValue(this._color)); - } else if ("hsl".indexOf(name) !== -1) { - this._color = Utils.extend(this._color, ColorUtils.hslValueToRGBValue(this._color)); + }); + return Clip; + } +}; + +//src/graphic/color.js +_p[28] = { + value: function(require, exports, module) { + var Utils = _p.r(12), StandardColor = _p.r(65), ColorUtils = {}, Color = _p.r(11).createClass("Color", { + constructor: function() { + var colorValue = null; + //parse构造 + if (typeof arguments[0] === "string") { + colorValue = ColorUtils.parseToValue(arguments[0]); + //解析失败 + if (colorValue === null) { + colorValue = { + r: 0, + g: 0, + b: 0, + h: 0, + s: 0, + l: 0, + a: 1 + }; + } + } else { + colorValue = { + r: arguments[0] | 0, + g: arguments[1] | 0, + b: arguments[2] | 0, + //alpha 默认为1 + a: parseFloat(arguments[3]) || 1 + }; + colorValue = ColorUtils.overflowFormat(colorValue); + //获取hsl分量 + colorValue = Utils.extend(colorValue, ColorUtils.rgbValueToHslValue(colorValue)); + } + this._color = colorValue; + }, + set: function(name, value) { + var values = null; + //设置的值非法 + if (!Color._MAX_VALUE[name]) { + throw new Error("Color set(): Illegal parameter"); + } + if (name !== "a") { + value = Math.floor(value); + } + if (name == "h") { + value = (value + 360) % 360; + } + this._color[name] = Math.max(Color._MIN_VALUE[name], Math.min(Color._MAX_VALUE[name], value)); + if ("rgb".indexOf(name) !== -1) { + this._color = Utils.extend(this._color, ColorUtils.rgbValueToHslValue(this._color)); + } else if ("hsl".indexOf(name) !== -1) { + this._color = Utils.extend(this._color, ColorUtils.hslValueToRGBValue(this._color)); + } + return this; + }, + inc: function(name, value) { + value = this.get(name) + value; + if (name == "h") { + value = (value + 360) % 360; + } else { + value = Math.min(Color._MAX_VALUE[name], value); + value = Math.max(Color._MIN_VALUE[name], value); + } + return this.clone().set(name, value); + }, + dec: function(name, value) { + return this.inc(name, -value); + }, + clone: function() { + return new Color(this.toRGBA()); + }, + get: function(name) { + if (!Color._MAX_VALUE[name]) { + return null; + } + return this._color[name]; + }, + getValues: function() { + return Utils.clone(this._color); + }, + valueOf: function() { + return this.getValues(); + }, + toRGB: function() { + return ColorUtils.toString(this._color, "rgb"); + }, + toRGBA: function() { + return ColorUtils.toString(this._color, "rgba"); + }, + toHEX: function() { + return ColorUtils.toString(this._color, "hex"); + }, + toHSL: function() { + return ColorUtils.toString(this._color, "hsl"); + }, + toHSLA: function() { + return ColorUtils.toString(this._color, "hsla"); + }, + //默认实现是调用toRGB或者toRGBA + toString: function() { + if (this._color.a === 1) { + return this.toRGB(); + } + return this.toRGBA(); } - return this; - }, - inc: function(name, value) { - value = this.get(name) + value; - if (name == "h") { - value = (value + 360) % 360; - } else { - value = Math.min(Color._MAX_VALUE[name], value); - value = Math.max(Color._MIN_VALUE[name], value); + }); + //Color 静态方法 + Utils.extend(Color, { + //各分量可表示的最大值 + _MAX_VALUE: { + r: 255, + g: 255, + b: 255, + h: 360, + s: 100, + l: 100, + a: 1 + }, + //各分量最小值 + _MIN_VALUE: { + r: 0, + g: 0, + b: 0, + h: 0, + s: 0, + l: 0, + a: 0 + }, + //分量常量 + R: "r", + G: "g", + B: "b", + H: "h", + S: "s", + L: "l", + A: "a", + parse: function(valStr) { + var rgbValue; + if (Utils.isString(valStr)) { + rgbValue = ColorUtils.parseToValue(valStr); + } + if (Utils.isObject(valStr) && "r" in valStr) { + rgbValue = valStr; + } + //解析失败, 返回一个默认color实例 + if (rgbValue === null) { + return new Color(); + } + return new Color(rgbValue.r, rgbValue.g, rgbValue.b, rgbValue.a); + }, + createHSL: function(h, s, l) { + return Color.createHSLA(h, s, l, 1); + }, + createHSLA: function(h, s, l, a) { + var colorValue = null; + s += "%"; + l += "%"; + colorValue = [ "hsla(" + h, s, l, a + ")" ]; + return Color.parse(colorValue.join(", ")); + }, + createRGB: function(r, g, b) { + return Color.createRGBA(r, g, b, 1); + }, + createRGBA: function(r, g, b, a) { + return new Color(r, g, b, a); } - return this.clone().set(name, value); - }, - dec: function(name, value) { - return this.inc(name, -value); - }, - clone: function() { - return new Color(this.toRGBA()); - }, - get: function(name) { - if (!Color._MAX_VALUE[name]) { + }); + //内部工具对象 + Utils.extend(ColorUtils, { + parseToValue: function(valStr) { + var rgbaValue = {}; + /* 优先检测在调色板中是否有对应的颜色 */ + valStr = StandardColor.EXTEND_STANDARD[valStr] || StandardColor.COLOR_STANDARD[valStr] || valStr; + /* 颜色转换 */ + //hex格式 + if (/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(valStr)) { + rgbaValue = ColorUtils.hexToValue(valStr); + } else if (/^(rgba?)/i.test(valStr)) { + rgbaValue = ColorUtils.rgbaToValue(valStr); + } else if (/^(hsla?)/i.test(valStr)) { + rgbaValue = ColorUtils.hslaToValue(valStr); + } else { + return null; + } + return ColorUtils.overflowFormat(rgbaValue); + }, + hexToValue: function(hexStr) { + var result = {}, keys = [ "r", "g", "b" ]; + if (/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(hexStr)) { + hexStr = RegExp.$1.split(""); + Utils.each(keys, function(key, index) { + if (hexStr.length === 3) { + result[key] = ColorUtils.toNumber(hexStr[index] + hexStr[index]); + } else { + result[key] = ColorUtils.toNumber(hexStr[index * 2] + hexStr[index * 2 + 1]); + } + }); + //转换出hsl值 + result = Utils.extend(result, ColorUtils.rgbValueToHslValue(result)); + result.a = 1; + return result; + } return null; - } - return this._color[name]; - }, - getValues: function() { - return Utils.clone(this._color); - }, - valueOf: function() { - return this.getValues(); - }, - toRGB: function() { - return ColorUtils.toString(this._color, "rgb"); - }, - toRGBA: function() { - return ColorUtils.toString(this._color, "rgba"); - }, - toHEX: function() { - return ColorUtils.toString(this._color, "hex"); - }, - toHSL: function() { - return ColorUtils.toString(this._color, "hsl"); - }, - toHSLA: function() { - return ColorUtils.toString(this._color, "hsla"); - }, - //默认实现是调用toRGB或者toRGBA - toString: function() { - if (this._color.a === 1) { - return this.toRGB(); - } - return this.toRGBA(); - } - }); - //Color 静态方法 - Utils.extend(Color, { - //各分量可表示的最大值 - _MAX_VALUE: { - r: 255, - g: 255, - b: 255, - h: 360, - s: 100, - l: 100, - a: 1 - }, - //各分量最小值 - _MIN_VALUE: { - r: 0, - g: 0, - b: 0, - h: 0, - s: 0, - l: 0, - a: 0 - }, - //分量常量 - R: "r", - G: "g", - B: "b", - H: "h", - S: "s", - L: "l", - A: "a", - parse: function(valStr) { - var rgbValue; - if (Utils.isString(valStr)) { - rgbValue = ColorUtils.parseToValue(valStr); - } - if (Utils.isObject(valStr) && "r" in valStr) { - rgbValue = valStr; - } - //解析失败, 返回一个默认color实例 - if (rgbValue === null) { - return new Color(); - } - return new Color(rgbValue.r, rgbValue.g, rgbValue.b, rgbValue.a); - }, - createHSL: function(h, s, l) { - return Color.createHSLA(h, s, l, 1); - }, - createHSLA: function(h, s, l, a) { - var colorValue = null; - s += "%"; - l += "%"; - colorValue = [ "hsla(" + h, s, l, a + ")" ]; - return Color.parse(colorValue.join(", ")); - }, - createRGB: function(r, g, b) { - return Color.createRGBA(r, g, b, 1); - }, - createRGBA: function(r, g, b, a) { - return new Color(r, g, b, a); - } - }); - //内部工具对象 - Utils.extend(ColorUtils, { - parseToValue: function(valStr) { - var rgbaValue = {}; - /* 优先检测在调色板中是否有对应的颜色 */ - valStr = StandardColor.EXTEND_STANDARD[valStr] || StandardColor.COLOR_STANDARD[valStr] || valStr; - /* 颜色转换 */ - //hex格式 - if (/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(valStr)) { - rgbaValue = ColorUtils.hexToValue(valStr); - } else if (/^(rgba?)/i.test(valStr)) { - rgbaValue = ColorUtils.rgbaToValue(valStr); - } else if (/^(hsla?)/i.test(valStr)) { - rgbaValue = ColorUtils.hslaToValue(valStr); - } else { + }, + rgbaToValue: function(rgbaStr) { + var result = {}, hasAlpha = false, keys = [ "r", "g", "b" ]; + if (/^(rgba?)/i.test(rgbaStr)) { + hasAlpha = RegExp.$1.length === 4; + rgbaStr = rgbaStr.replace(/^rgba?/i, "").replace(/\s+/g, "").replace(/[^0-9,.]/g, "").split(","); + Utils.each(keys, function(key, index) { + result[key] = rgbaStr[index] | 0; + }); + //转换出hsl值 + result = Utils.extend(result, ColorUtils.rgbValueToHslValue(result)); + result.a = hasAlpha ? parseFloat(rgbaStr[3]) : 1; + return result; + } return null; - } - return ColorUtils.overflowFormat(rgbaValue); - }, - hexToValue: function(hexStr) { - var result = {}, keys = [ "r", "g", "b" ]; - if (/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(hexStr)) { - hexStr = RegExp.$1.split(""); - Utils.each(keys, function(key, index) { - if (hexStr.length === 3) { - result[key] = ColorUtils.toNumber(hexStr[index] + hexStr[index]); + }, + hslaToValue: function(hslaStr) { + var result = {}, hasAlpha = false; + if (/^(hsla?)/i.test(hslaStr)) { + hasAlpha = RegExp.$1.length === 4; + hslaStr = hslaStr.replace(/^hsla?/i, "").replace(/\s+/g, "").replace(/[^0-9,.]/g, "").split(","); + //记录hsl值 + result.h = hslaStr[0] | 0; + result.s = hslaStr[1] | 0; + result.l = hslaStr[2] | 0; + //转换出rgb值 + result = Utils.extend(result, ColorUtils.hslValueToRGBValue(result)); + //hsl值转换为rgb值 + result = ColorUtils.hslValueToRGBValue(result); + result.a = hasAlpha ? parseFloat(hslaStr[3]) : 1; + return result; + } + return null; + }, + //hsl值对象转换为rgb值对象 + hslValueToRGBValue: function(hslValue) { + function trans(v1, v2, vH) { + if (vH < 0) { + vH += 1; + } else if (vH > 1) { + vH -= 1; + } + if (6 * vH < 1) { + return v1 + (v2 - v1) * 6 * vH; + } else if (2 * vH < 1) { + return v2; + } else if (3 * vH < 2) { + return v1 + (v2 - v1) * ((2 / 3 - vH) * 6); + } + return v1; + } + var q = null, p = null, result = {}; + hslValue = Utils.extend({}, hslValue); + hslValue.h = hslValue.h / 360; + hslValue.s = hslValue.s / 100; + hslValue.l = hslValue.l / 100; + //分量计算 + if (hslValue.s === 0) { + result.r = result.g = result.b = hslValue.l; + } else { + if (hslValue.l < .5) { + q = hslValue.l * (1 + hslValue.s); } else { - result[key] = ColorUtils.toNumber(hexStr[index * 2] + hexStr[index * 2 + 1]); + q = hslValue.l + hslValue.s - hslValue.l * hslValue.s; } - }); - //转换出hsl值 - result = Utils.extend(result, ColorUtils.rgbValueToHslValue(result)); - result.a = 1; + p = 2 * hslValue.l - q; + result.r = trans(p, q, hslValue.h + 1 / 3); + result.g = trans(p, q, hslValue.h); + result.b = trans(p, q, hslValue.h - 1 / 3); + } + result.r = Math.min(Math.round(result.r * 255), 255); + result.g = Math.min(Math.round(result.g * 255), 255); + result.b = Math.min(Math.round(result.b * 255), 255); return result; - } - return null; - }, - rgbaToValue: function(rgbaStr) { - var result = {}, hasAlpha = false, keys = [ "r", "g", "b" ]; - if (/^(rgba?)/i.test(rgbaStr)) { - hasAlpha = RegExp.$1.length === 4; - rgbaStr = rgbaStr.replace(/^rgba?/i, "").replace(/\s+/g, "").replace(/[^0-9,.]/g, "").split(","); - Utils.each(keys, function(key, index) { - result[key] = rgbaStr[index] | 0; - }); - //转换出hsl值 - result = Utils.extend(result, ColorUtils.rgbValueToHslValue(result)); - result.a = hasAlpha ? parseFloat(rgbaStr[3]) : 1; + }, + //rgb值对象转换为hsl值对象 + rgbValueToHslValue: function(rgbValue) { + var max = null, min = null, result = {}; + rgbValue = Utils.extend({}, rgbValue); + rgbValue.r = rgbValue.r / 255; + rgbValue.g = rgbValue.g / 255; + rgbValue.b = rgbValue.b / 255; + max = Math.max(rgbValue.r, rgbValue.g, rgbValue.b); + min = Math.min(rgbValue.r, rgbValue.g, rgbValue.b); + //h分量计算 + if (max === min) { + result.h = 0; + } else if (max === rgbValue.r) { + if (rgbValue.g >= rgbValue.b) { + result.h = 60 * (rgbValue.g - rgbValue.b) / (max - min); + } else { + result.h = 60 * (rgbValue.g - rgbValue.b) / (max - min) + 360; + } + } else if (max === rgbValue.g) { + result.h = 60 * (rgbValue.b - rgbValue.r) / (max - min) + 120; + } else if (max === rgbValue.b) { + result.h = 60 * (rgbValue.r - rgbValue.g) / (max - min) + 240; + } + //l分量计算 + result.l = (max + min) / 2; + //s分量计算 + if (result.l === 0 || max === min) { + result.s = 0; + } else if (result.l > 0 && result.l <= .5) { + result.s = (max - min) / (max + min); + } else { + result.s = (max - min) / (2 - max - min); + } + //格式化hsl结果 + result.h = Math.round(result.h); + result.s = Math.round(result.s * 100); + result.l = Math.round(result.l * 100); return result; - } - return null; - }, - hslaToValue: function(hslaStr) { - var result = {}, hasAlpha = false; - if (/^(hsla?)/i.test(hslaStr)) { - hasAlpha = RegExp.$1.length === 4; - hslaStr = hslaStr.replace(/^hsla?/i, "").replace(/\s+/g, "").replace(/[^0-9,.]/g, "").split(","); - //记录hsl值 - result.h = hslaStr[0] | 0; - result.s = hslaStr[1] | 0; - result.l = hslaStr[2] | 0; - //转换出rgb值 - result = Utils.extend(result, ColorUtils.hslValueToRGBValue(result)); - //hsl值转换为rgb值 - result = ColorUtils.hslValueToRGBValue(result); - result.a = hasAlpha ? parseFloat(hslaStr[3]) : 1; - return result; - } - return null; - }, - //hsl值对象转换为rgb值对象 - hslValueToRGBValue: function(hslValue) { - function trans(v1, v2, vH) { - if (vH < 0) { - vH += 1; - } else if (vH > 1) { - vH -= 1; - } - if (6 * vH < 1) { - return v1 + (v2 - v1) * 6 * vH; - } else if (2 * vH < 1) { - return v2; - } else if (3 * vH < 2) { - return v1 + (v2 - v1) * (2 / 3 - vH) * 6; - } - return v1; - } - var q = null, p = null, result = {}; - hslValue = Utils.extend({}, hslValue); - hslValue.h = hslValue.h / 360; - hslValue.s = hslValue.s / 100; - hslValue.l = hslValue.l / 100; - //分量计算 - if (hslValue.s === 0) { - result.r = result.g = result.b = hslValue.l; - } else { - if (hslValue.l < .5) { - q = hslValue.l * (1 + hslValue.s); - } else { - q = hslValue.l + hslValue.s - hslValue.l * hslValue.s; + }, + toString: function(colorValue, type) { + var vals = []; + colorValue = Utils.extend({}, colorValue); + if (type.indexOf("hsl") !== -1) { + colorValue.s += "%"; + colorValue.l += "%"; } - p = 2 * hslValue.l - q; - result.r = trans(p, q, hslValue.h + 1 / 3); - result.g = trans(p, q, hslValue.h); - result.b = trans(p, q, hslValue.h - 1 / 3); - } - result.r = Math.min(Math.round(result.r * 255), 255); - result.g = Math.min(Math.round(result.g * 255), 255); - result.b = Math.min(Math.round(result.b * 255), 255); - return result; - }, - //rgb值对象转换为hsl值对象 - rgbValueToHslValue: function(rgbValue) { - var max = null, min = null, result = {}; - rgbValue = Utils.extend({}, rgbValue); - rgbValue.r = rgbValue.r / 255; - rgbValue.g = rgbValue.g / 255; - rgbValue.b = rgbValue.b / 255; - max = Math.max(rgbValue.r, rgbValue.g, rgbValue.b); - min = Math.min(rgbValue.r, rgbValue.g, rgbValue.b); - //h分量计算 - if (max === min) { - result.h = 0; - } else if (max === rgbValue.r) { - if (rgbValue.g >= rgbValue.b) { - result.h = 60 * (rgbValue.g - rgbValue.b) / (max - min); + if (type !== "hex") { + Utils.each(type.split(""), function(key) { + vals.push(colorValue[key]); + }); + return (type + "(" + vals.join(", ") + ")").toLowerCase(); } else { - result.h = 60 * (rgbValue.g - rgbValue.b) / (max - min) + 360; - } - } else if (max === rgbValue.g) { - result.h = 60 * (rgbValue.b - rgbValue.r) / (max - min) + 120; - } else if (max === rgbValue.b) { - result.h = 60 * (rgbValue.r - rgbValue.g) / (max - min) + 240; - } - //l分量计算 - result.l = (max + min) / 2; - //s分量计算 - if (result.l === 0 || max === min) { - result.s = 0; - } else if (result.l > 0 && result.l <= .5) { - result.s = (max - min) / (max + min); - } else { - result.s = (max - min) / (2 - max - min); - } - //格式化hsl结果 - result.h = Math.round(result.h); - result.s = Math.round(result.s * 100); - result.l = Math.round(result.l * 100); - return result; - }, - toString: function(colorValue, type) { - var vals = []; - colorValue = Utils.extend({}, colorValue); - if (type.indexOf("hsl") !== -1) { - colorValue.s += "%"; - colorValue.l += "%"; - } - if (type !== "hex") { - Utils.each(type.split(""), function(key) { - vals.push(colorValue[key]); + vals.push(ColorUtils.toHexValue(+colorValue.r)); + vals.push(ColorUtils.toHexValue(+colorValue.g)); + vals.push(ColorUtils.toHexValue(+colorValue.b)); + return ("#" + vals.join("")).toLowerCase(); + } + }, + //16进制的2个数字转化为10进制, 如果转化失败, 返回0 + toNumber: function(value) { + return Number("0x" + value) | 0; + }, + toHexValue: function(value) { + var result = value.toString(16); + return result.length === 1 ? "0" + result : result; + }, + //溢出控制 + overflowFormat: function(value) { + var tmpValue = Utils.extend({}, value), keys = "rgba"; + Utils.each(keys.split(""), function(key) { + if (!tmpValue.hasOwnProperty(key)) { + return; + } + //上溢出 + tmpValue[key] = Math.min(Color._MAX_VALUE[key], tmpValue[key]); + //下溢出 + tmpValue[key] = Math.max(Color._MIN_VALUE[key], tmpValue[key]); }); - return (type + "(" + vals.join(", ") + ")").toLowerCase(); - } else { - vals.push(ColorUtils.toHexValue(+colorValue.r)); - vals.push(ColorUtils.toHexValue(+colorValue.g)); - vals.push(ColorUtils.toHexValue(+colorValue.b)); - return ("#" + vals.join("")).toLowerCase(); + return tmpValue; } - }, - //16进制的2个数字转化为10进制, 如果转化失败, 返回0 - toNumber: function(value) { - return Number("0x" + value) | 0; - }, - toHexValue: function(value) { - var result = value.toString(16); - return result.length === 1 ? "0" + result : result; - }, - //溢出控制 - overflowFormat: function(value) { - var tmpValue = Utils.extend({}, value), keys = "rgba"; - Utils.each(keys.split(""), function(key) { - if (!tmpValue.hasOwnProperty(key)) { - return; - } - //上溢出 - tmpValue[key] = Math.min(Color._MAX_VALUE[key], tmpValue[key]); - //下溢出 - tmpValue[key] = Math.max(Color._MIN_VALUE[key], tmpValue[key]); - }); - return tmpValue; - } - }); - return Color; -}); -define("graphic/container", [ "core/class" ], function(require, exports, module) { - function itemRemove() { - this.container.removeItem(this); - return this; + }); + return Color; } - return require("core/class").createClass("Container", { - getItems: function() { - return this.items || (this.items = []); - }, - getItem: function(index) { - return this.getItems()[index]; - }, - getFirstItem: function() { - return this.getItem(0); - }, - getLastItem: function() { - return this.getItem(this.getItems().length - 1); - }, - indexOf: function(item) { - return this.getItems().indexOf(item); - }, - eachItem: function(fn) { - var items = this.getItems(), length = items.length, i; - for (i = 0; i < length; i++) { - fn.call(this, i, items[i]); - } +}; + +//src/graphic/container.js +_p[29] = { + value: function(require, exports, module) { + function itemRemove() { + this.container.removeItem(this); return this; - }, - addItem: function(item, pos, noEvent) { - var items = this.getItems(), length = items.length; - if (~items.indexOf(item)) { + } + return _p.r(11).createClass("Container", { + getItems: function() { + return this.items || (this.items = []); + }, + getItem: function(index) { + return this.getItems()[index]; + }, + getFirstItem: function() { + return this.getItem(0); + }, + getLastItem: function() { + return this.getItem(this.getItems().length - 1); + }, + indexOf: function(item) { + return this.getItems().indexOf(item); + }, + eachItem: function(fn) { + var items = this.getItems(), length = items.length, i; + for (i = 0; i < length; i++) { + fn.call(this, i, items[i]); + } return this; - } - if (!(pos >= 0 && pos < length)) { - pos = length; - } - items.splice(pos, 0, item); - if (typeof item === "object") { - item.container = this; - item.remove = itemRemove; - } - this.handleAdd(item, pos); - if (!noEvent) { - this.onContainerChanged("add", [ item ]); - } - return this; - }, - addItems: function(items) { - for (var i = 0, l = items.length; i < l; i++) { - this.addItem(items[i], -1, true); - } - this.onContainerChanged("add", items); - return this; - }, - setItems: function(items) { - return this.clear().addItems(items); - }, - appendItem: function(item) { - return this.addItem(item); - }, - prependItem: function(item) { - return this.addItem(item, 0); - }, - removeItem: function(pos, noEvent) { - if (typeof pos !== "number") { - return this.removeItem(this.indexOf(pos)); - } - var items = this.getItems(), length = items.length, item = items[pos]; - if (item === undefined) { + }, + addItem: function(item, pos, noEvent) { + var items = this.getItems(), length = items.length; + if (~items.indexOf(item)) { + return this; + } + if (!(pos >= 0 && pos < length)) { + pos = length; + } + items.splice(pos, 0, item); + if (typeof item === "object") { + item.container = this; + item.remove = itemRemove; + } + this.handleAdd(item, pos); + if (!noEvent) { + this.onContainerChanged("add", [ item ]); + } return this; - } - items.splice(pos, 1); - if (item.container) { - delete item.container; - } - if (item.remove) { - delete item.remove; - } - this.handleRemove(item, pos); - if (!noEvent) { - this.onContainerChanged("remove", [ item ]); - } - return this; - }, - clear: function() { - var removed = []; - var item; - while (item = this.getFirstItem()) { - removed.push(item); - this.removeItem(0, true); - } - this.onContainerChanged("remove", removed); - return this; - }, - onContainerChanged: function(type, items) {}, - handleAdd: function(item, index) {}, - handleRemove: function(item, index) {} - }); -}); + }, + addItems: function(items) { + for (var i = 0, l = items.length; i < l; i++) { + this.addItem(items[i], -1, true); + } + this.onContainerChanged("add", items); + return this; + }, + setItems: function(items) { + return this.clear().addItems(items); + }, + appendItem: function(item) { + return this.addItem(item); + }, + prependItem: function(item) { + return this.addItem(item, 0); + }, + removeItem: function(pos, noEvent) { + if (typeof pos !== "number") { + return this.removeItem(this.indexOf(pos)); + } + var items = this.getItems(), length = items.length, item = items[pos]; + if (item === undefined) { + return this; + } + items.splice(pos, 1); + if (item.container) { + delete item.container; + } + if (item.remove) { + delete item.remove; + } + this.handleRemove(item, pos); + if (!noEvent) { + this.onContainerChanged("remove", [ item ]); + } + return this; + }, + clear: function() { + var removed = []; + var item; + while (item = this.getFirstItem()) { + removed.push(item); + this.removeItem(0, true); + } + this.onContainerChanged("remove", removed); + return this; + }, + onContainerChanged: function(type, items) {}, + handleAdd: function(item, index) {}, + handleRemove: function(item, index) {} + }); + } +}; + +//src/graphic/curve.js /* * 曲线 * */ -define("graphic/curve", [ "core/utils", "core/class", "graphic/path", "graphic/shape", "graphic/svg", "graphic/geometry", "graphic/pointcontainer", "graphic/container" ], function(require, exports, module) { - var Utils = require("core/utils"), CurveUtil = { - /* +_p[30] = { + value: function(require, exports, module) { + var Utils = _p.r(12), CurveUtil = { + /* * 获取由两个以上的点组成的曲线的平移线 * @param points 曲线上的点的集合, 集合中的点的数量必须大于2 * @return 平移线数组 */ - getCurvePanLines: function(points, smoothFactor) { - //计算原始点的中点坐标 - var centerPoints = CurveUtil.getCenterPoints(points), //注意:计算中点连线的中点坐标, 得出平移线 - panLines = CurveUtil.getPanLine(points.length, centerPoints); - //平移线移动到顶点 - return CurveUtil.getMovedPanLines(points, panLines, smoothFactor); - }, - /* + getCurvePanLines: function(points, smoothFactor) { + //计算原始点的中点坐标 + var centerPoints = CurveUtil.getCenterPoints(points), //注意:计算中点连线的中点坐标, 得出平移线 + panLines = CurveUtil.getPanLine(points.length, centerPoints); + //平移线移动到顶点 + return CurveUtil.getMovedPanLines(points, panLines, smoothFactor); + }, + /* * 计算给定点集合的连线的中点 * @param points */ - getCenterPoints: function(points) { - var centerPoints = {}, key = null; - for (var i = 0, j = 0, len = points.length; i < len; i++) { - //j是下一个点的索引 - j = i === len - 1 ? 0 : i + 1; - key = i + "," + j; - //计算中点坐标 - centerPoints[key] = { - x: (points[i].x + points[j].y) / 2, - y: (points[i].x + points[j].y) / 2 - }; - } - return centerPoints; - }, - /* + getCenterPoints: function(points) { + var centerPoints = {}, key = null; + for (var i = 0, j = 0, len = points.length; i < len; i++) { + //j是下一个点的索引 + j = i === len - 1 ? 0 : i + 1; + key = i + "," + j; + //计算中点坐标 + centerPoints[key] = { + x: (points[i].x + points[j].y) / 2, + y: (points[i].x + points[j].y) / 2 + }; + } + return centerPoints; + }, + /* * 对getCenterPoints()接口获取到的数据做处理, 计算出各个顶点对应的平移线数据 * @param length 集合中点的个数 * @param points 点集合, 该集合应该是getCenterPoints()接口返回的数据 */ - getPanLine: function(length, points) { - var result = {}, //顶点索引 - pointIndex = null; - for (var i = 0, j; i < length; i++) { - var point1 = null, point2 = null; - //计算当前点 - j = (i + 1) % length; - //保存当前处理的顶点索引 - pointIndex = j; - point1 = points[i + "," + j]; - //计算下一个点 - i = j; - j = (i + 1) % length; - point2 = points[i + "," + j]; - result[pointIndex] = { - points: [ { - x: point1.x, - y: point1.y - }, { - x: point2.x, - y: point2.y - } ], - center: { - x: (point1.x + point2.x) / 2, - y: (point1.y + point2.y) / 2 - } - }; - //还原i值 - i = (pointIndex + length - 1) % length; - } - return result; - }, - /* + getPanLine: function(length, points) { + var result = {}, //顶点索引 + pointIndex = null; + for (var i = 0, j; i < length; i++) { + var point1 = null, point2 = null; + //计算当前点 + j = (i + 1) % length; + //保存当前处理的顶点索引 + pointIndex = j; + point1 = points[i + "," + j]; + //计算下一个点 + i = j; + j = (i + 1) % length; + point2 = points[i + "," + j]; + result[pointIndex] = { + points: [ { + x: point1.x, + y: point1.y + }, { + x: point2.x, + y: point2.y + } ], + center: { + x: (point1.x + point2.x) / 2, + y: (point1.y + point2.y) / 2 + } + }; + //还原i值 + i = (pointIndex + length - 1) % length; + } + return result; + }, + /* * 计算平移线移动到顶点后的位置 * @param points 顶点集合 * @param panLines 平移线集合 */ - getMovedPanLines: function(points, panLines, smoothFactor) { - var result = {}; - Utils.each(points, function(point, index) { - //当前平移线 - var currentPanLine = panLines[index], //平移线中点 - center = currentPanLine.center, //移动距离 - distance = { - x: center.x - point.x, - y: center.y - point.y - }; - var currentResult = result[index] = { - points: [], - center: { - x: point.x, - y: point.y - } - }; - //计算控制点到顶点的距离, 并且应用平滑系数到距离上 - Utils.each(currentPanLine.points, function(controlPoint, index) { - var moved = { - x: controlPoint.x - distance.x, - y: controlPoint.y - distance.y + getMovedPanLines: function(points, panLines, smoothFactor) { + var result = {}; + Utils.each(points, function(point, index) { + //当前平移线 + var currentPanLine = panLines[index], //平移线中点 + center = currentPanLine.center, //移动距离 + distance = { + x: center.x - point.x, + y: center.y - point.y + }; + var currentResult = result[index] = { + points: [], + center: { + x: point.x, + y: point.y + } }; - var vertex = currentResult.center; - var dx = moved.x - vertex.x; - var dy = moved.y - vertex.y; - moved.x = vertex.x + smoothFactor * dx; - moved.y = vertex.y + smoothFactor * dy; - currentResult.points.push(moved); + //计算控制点到顶点的距离, 并且应用平滑系数到距离上 + Utils.each(currentPanLine.points, function(controlPoint, index) { + var moved = { + x: controlPoint.x - distance.x, + y: controlPoint.y - distance.y + }; + var vertex = currentResult.center; + var dx = moved.x - vertex.x; + var dy = moved.y - vertex.y; + moved.x = vertex.x + smoothFactor * dx; + moved.y = vertex.y + smoothFactor * dy; + currentResult.points.push(moved); + }); }); - }); - return result; - } - }; - return require("core/class").createClass("Curve", { - base: require("graphic/path"), - mixins: [ require("graphic/pointcontainer") ], - constructor: function(points, isColse) { - this.callBase(); - this.setPoints(points || []); - this.closeState = !!isColse; - this.changeable = true; - this.smoothFactor = 1; - this.update(); - }, - //当点集合发生变化时采取的动作 - onContainerChanged: function() { - if (this.changeable) { - this.update(); + return result; } - }, - setSmoothFactor: function(factor) { - this.smoothFactor = factor < 0 ? 0 : factor; - this.update(); - return this; - }, - getSmoothFactor: function() { - return this.smoothFactor; - }, - update: function() { - var points = this.getPoints(), withControlPoints = null, drawer = this.getDrawer(), curPoint = null, curControlPoint = null, prevControlPoint = null; - drawer.clear(); - if (points.length === 0) { + }; + return _p.r(11).createClass("Curve", { + base: _p.r(47), + mixins: [ _p.r(52) ], + constructor: function(points, isColse) { + this.callBase(); + this.setPoints(points || []); + this.closeState = !!isColse; + this.changeable = true; + this.smoothFactor = 1; + this.update(); + }, + //当点集合发生变化时采取的动作 + onContainerChanged: function() { + if (this.changeable) { + this.update(); + } + }, + setSmoothFactor: function(factor) { + this.smoothFactor = factor < 0 ? 0 : factor; + this.update(); return this; - } else { - drawer.moveTo(points[0]); - } - if (points.length === 1) { + }, + getSmoothFactor: function() { + return this.smoothFactor; + }, + update: function() { + var points = this.getPoints(), withControlPoints = null, drawer = this.getDrawer(), curPoint = null, curControlPoint = null, prevControlPoint = null; + drawer.clear(); + if (points.length === 0) { + return this; + } else { + drawer.moveTo(points[0]); + } + if (points.length === 1) { + return this; + } + if (points.length === 2) { + drawer.lineTo(points[1]); + return this; + } + //获取已转换过后的带控制点的所有点 + withControlPoints = CurveUtil.getCurvePanLines(points, this.getSmoothFactor()); + for (var i = 1, len = points.length; i < len; i++) { + //当前顶点 + curPoint = withControlPoints[i].center; + //当前控制点 + if (this.closeState || i != len - 1) { + curControlPoint = withControlPoints[i].points[0]; + } else { + //非闭合状态下最后一个点的处理 + curControlPoint = withControlPoints[i].center; + } + if (this.closeState || i != 1) { + prevControlPoint = withControlPoints[i - 1].points[1]; + } else { + //非闭合状态下第一个点的处理 + prevControlPoint = withControlPoints[i - 1].center; + } + drawer.bezierTo(prevControlPoint.x, prevControlPoint.y, curControlPoint.x, curControlPoint.y, curPoint.x, curPoint.y); + } + //处理闭合 + if (this.closeState) { + curPoint = withControlPoints[0].center; + curControlPoint = withControlPoints[0].points[0]; + prevControlPoint = withControlPoints[points.length - 1].points[1]; + drawer.bezierTo(prevControlPoint.x, prevControlPoint.y, curControlPoint.x, curControlPoint.y, curPoint.x, curPoint.y); + } return this; + }, + close: function() { + this.closeState = true; + return this.update(); + }, + open: function() { + this.closeState = false; + return this.update(); + }, + isClose: function() { + return !!this.closeState; } - if (points.length === 2) { - drawer.lineTo(points[1]); + }); + } +}; + +//src/graphic/data.js +_p[31] = { + value: function(require, exports, module) { + return _p.r(11).createClass("Data", { + constructor: function() { + this._data = {}; + }, + setData: function(name, value) { + this._data[name] = value; + return this; + }, + getData: function(name) { + return this._data[name]; + }, + removeData: function(name) { + delete this._data[name]; return this; } - //获取已转换过后的带控制点的所有点 - withControlPoints = CurveUtil.getCurvePanLines(points, this.getSmoothFactor()); - for (var i = 1, len = points.length; i < len; i++) { - //当前顶点 - curPoint = withControlPoints[i].center; - //当前控制点 - if (this.closeState || i != len - 1) { - curControlPoint = withControlPoints[i].points[0]; - } else { - //非闭合状态下最后一个点的处理 - curControlPoint = withControlPoints[i].center; - } - if (this.closeState || i != 1) { - prevControlPoint = withControlPoints[i - 1].points[1]; - } else { - //非闭合状态下第一个点的处理 - prevControlPoint = withControlPoints[i - 1].center; - } - drawer.bezierTo(prevControlPoint.x, prevControlPoint.y, curControlPoint.x, curControlPoint.y, curPoint.x, curPoint.y); + }); + } +}; + +//src/graphic/defbrush.js +_p[32] = { + value: function(require, exports, module) { + return _p.r(11).createClass("GradientBrush", { + base: _p.r(59), + constructor: function(nodeType) { + this.callBase(nodeType); } - //处理闭合 - if (this.closeState) { - curPoint = withControlPoints[0].center; - curControlPoint = withControlPoints[0].points[0]; - prevControlPoint = withControlPoints[points.length - 1].points[1]; - drawer.bezierTo(prevControlPoint.x, prevControlPoint.y, curControlPoint.x, curControlPoint.y, curPoint.x, curPoint.y); + }); + } +}; + +//src/graphic/ellipse.js +_p[33] = { + value: function(require, exports, module) { + var Utils = _p.r(12), Point = _p.r(51); + return _p.r(11).createClass("Ellipse", { + base: _p.r(47), + constructor: function(rx, ry, cx, cy) { + this.callBase(); + this.rx = rx || 0; + this.ry = ry || 0; + this.cx = cx || 0; + this.cy = cy || 0; + this.update(); + }, + update: function() { + var rx = this.rx, ry = this.ry, x1 = this.cx + rx, x2 = this.cx - rx, y = this.cy; + var drawer = this.getDrawer(); + drawer.clear(); + drawer.moveTo(x1, y); + drawer.arcTo(rx, ry, 0, 1, 1, x2, y); + drawer.arcTo(rx, ry, 0, 1, 1, x1, y); + return this; + }, + getRadius: function() { + return { + x: this.rx, + y: this.ry + }; + }, + getRadiusX: function() { + return this.rx; + }, + getRadiusY: function() { + return this.ry; + }, + getCenter: function() { + return new Point(this.cx, this.cy); + }, + getCenterX: function() { + return this.cx; + }, + getCenterY: function() { + return this.cy; + }, + setRadius: function(rx, ry) { + this.rx = rx; + this.ry = ry; + return this.update(); + }, + setRadiusX: function(rx) { + this.rx = rx; + return this.update(); + }, + setRadiusY: function(ry) { + this.ry = ry; + return this.update(); + }, + setCenter: function(cx, cy) { + if (arguments.length == 1) { + var p = Point.parse(arguments[0]); + cx = p.x; + cy = p.y; + } + this.cx = cx; + this.cy = cy; + return this.update(); + }, + setCenterX: function(cx) { + this.cx = cx; + return this.update(); + }, + setCenterY: function(cy) { + this.cy = cy; + return this.update(); } - return this; - }, - close: function() { - this.closeState = true; - return this.update(); - }, - open: function() { - this.closeState = false; - return this.update(); - }, - isClose: function() { - return !!this.closeState; - } - }); -}); -define("graphic/data", [ "core/class" ], function(require, exports, module) { - return require("core/class").createClass("Data", { - constructor: function() { - this._data = {}; - }, - setData: function(name, value) { - this._data[name] = value; - return this; - }, - getData: function(name) { - return this._data[name]; - }, - removeData: function(name) { - delete this._data[name]; - return this; - } - }); -}); -define("graphic/defbrush", [ "core/class", "graphic/resource", "graphic/svg" ], function(require, exports, module) { - return require("core/class").createClass("GradientBrush", { - base: require("graphic/resource"), - constructor: function(nodeType) { - this.callBase(nodeType); - } - }); -}); -define("graphic/ellipse", [ "core/utils", "graphic/point", "core/class", "graphic/path", "graphic/shape", "graphic/svg", "graphic/geometry" ], function(require, exports, module) { - var Utils = require("core/utils"), Point = require("graphic/point"); - return require("core/class").createClass("Ellipse", { - base: require("graphic/path"), - constructor: function(rx, ry, cx, cy) { - this.callBase(); - this.rx = rx || 0; - this.ry = ry || 0; - this.cx = cx || 0; - this.cy = cy || 0; - this.update(); - }, - update: function() { - var rx = this.rx, ry = this.ry, x1 = this.cx + rx, x2 = this.cx - rx, y = this.cy; - var drawer = this.getDrawer(); - drawer.clear(); - drawer.moveTo(x1, y); - drawer.arcTo(rx, ry, 0, 1, 1, x2, y); - drawer.arcTo(rx, ry, 0, 1, 1, x1, y); - return this; - }, - getRadius: function() { - return { - x: this.rx, - y: this.ry - }; - }, - getRadiusX: function() { - return this.rx; - }, - getRadiusY: function() { - return this.ry; - }, - getCenter: function() { - return new Point(this.cx, this.cy); - }, - getCenterX: function() { - return this.cx; - }, - getCenterY: function() { - return this.cy; - }, - setRadius: function(rx, ry) { - this.rx = rx; - this.ry = ry; - return this.update(); - }, - setRadiusX: function(rx) { - this.rx = rx; - return this.update(); - }, - setRadiusY: function(ry) { - this.ry = ry; - return this.update(); - }, - setCenter: function(cx, cy) { - if (arguments.length == 1) { - var p = Point.parse(arguments[0]); - cx = p.x; - cy = p.y; - } - this.cx = cx; - this.cy = cy; - return this.update(); - }, - setCenterX: function(cx) { - this.cx = cx; - return this.update(); - }, - setCenterY: function(cy) { - this.cy = cy; - return this.update(); - } - }); -}); + }); + } +}; + +//src/graphic/eventhandler.js /* * kity event 实现 */ -define("graphic/eventhandler", [ "core/utils", "graphic/shapeevent", "graphic/matrix", "graphic/point", "core/class" ], function(require, exports, module) { - // polyfill - (function() { - function CustomEvent(event, params) { - params = params || { - bubbles: false, - cancelable: false, - detail: undefined - }; - var evt = document.createEvent("CustomEvent"); - evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); - return evt; - } - CustomEvent.prototype = window.Event.prototype; - window.CustomEvent = CustomEvent; - })(); - var Utils = require("core/utils"), ShapeEvent = require("graphic/shapeevent"); - // 内部处理器缓存 - var INNER_HANDLER_CACHE = {}, // 用户处理器缓存 - USER_HANDLER_CACHE = {}, guid = 0; - // 添加事件统一入口 - function _addEvent(type, handler, isOnce) { - isOnce = !!isOnce; - if (Utils.isString(type)) { - type = type.match(/\S+/g); - } - Utils.each(type, function(currentType) { - listen.call(this, this.node, currentType, handler, isOnce); - }, this); - return this; - } - // 移除事件统一入口 - function _removeEvent(type, handler) { - var userHandlerList = null, eventId = this._EVNET_UID, isRemoveAll = handler === undefined; - try { - userHandlerList = USER_HANDLER_CACHE[eventId][type]; - } catch (e) { - return; - } - //移除指定的监听器 - if (!isRemoveAll) { - isRemoveAll = true; - Utils.each(userHandlerList, function(fn, index) { - if (fn === handler) { - // 不能结束, 需要查找完整个list, 避免丢失移除多次绑定同一个处理器的情况 - delete userHandlerList[index]; - } else { - isRemoveAll = false; - } - }); - } - //删除所有监听器 - if (isRemoveAll) { - deleteDomEvent(this.node, type, INNER_HANDLER_CACHE[eventId][type]); - delete USER_HANDLER_CACHE[eventId][type]; - delete INNER_HANDLER_CACHE[eventId][type]; - } - return this; - } - // 执行绑定, 该方法context为shape或者mixin了eventhandler的对象 - function listen(node, type, handler, isOnce) { - var eid = this._EVNET_UID, targetObject = this; - // 初始化内部监听器 - if (!INNER_HANDLER_CACHE[eid]) { - INNER_HANDLER_CACHE[eid] = {}; +_p[34] = { + value: function(require, exports, module) { + // polyfill + (function() { + function CustomEvent(event, params) { + params = params || { + bubbles: false, + cancelable: false, + detail: undefined + }; + var evt = document.createEvent("CustomEvent"); + evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); + return evt; + } + CustomEvent.prototype = window.Event.prototype; + window.CustomEvent = CustomEvent; + })(); + var Utils = _p.r(12), ShapeEvent = _p.r(63); + // 内部处理器缓存 + var INNER_HANDLER_CACHE = {}, // 用户处理器缓存 + USER_HANDLER_CACHE = {}, guid = 0; + // 添加事件统一入口 + function _addEvent(type, handler, isOnce) { + isOnce = !!isOnce; + if (Utils.isString(type)) { + type = type.match(/\S+/g); + } + Utils.each(type, function(currentType) { + listen.call(this, this.node, currentType, handler, isOnce); + }, this); + return this; } - if (!INNER_HANDLER_CACHE[eid][type]) { - // 内部监听器 - INNER_HANDLER_CACHE[eid][type] = function(e) { - e = new ShapeEvent(e || window.event); - Utils.each(USER_HANDLER_CACHE[eid][type], function(fn) { - var result; - if (fn) { - result = fn.call(targetObject, e); - //once 绑定, 执行完后删除 - if (isOnce) { - targetObject.off(type, fn); - } + // 移除事件统一入口 + function _removeEvent(type, handler) { + var userHandlerList = null, eventId = this._EVNET_UID, isRemoveAll = handler === undefined; + try { + userHandlerList = USER_HANDLER_CACHE[eventId][type]; + } catch (e) { + return; + } + //移除指定的监听器 + if (!isRemoveAll) { + isRemoveAll = true; + Utils.each(userHandlerList, function(fn, index) { + if (fn === handler) { + // 不能结束, 需要查找完整个list, 避免丢失移除多次绑定同一个处理器的情况 + delete userHandlerList[index]; + } else { + isRemoveAll = false; } - // 如果用户handler里return了false, 则该节点上的此后的同类型事件将不再执行 - return result; - }, targetObject); - }; - } - // 初始化用户监听器列表 - if (!USER_HANDLER_CACHE[eid]) { - USER_HANDLER_CACHE[eid] = {}; - } - if (!USER_HANDLER_CACHE[eid][type]) { - USER_HANDLER_CACHE[eid][type] = [ handler ]; - // 绑定对应类型的事件 - // dom对象利用dom event进行处理, 非dom对象, 由消息分发机制处理 - if (!!node) { - bindDomEvent(node, type, INNER_HANDLER_CACHE[eid][type]); + }); } - } else { - USER_HANDLER_CACHE[eid][type].push(handler); - } - } - // 绑定dom事件 - function bindDomEvent(node, type, handler) { - if (node.addEventListener) { - node.addEventListener(type, handler, false); - } else { - node.attachEvent("on" + type, handler); - } - } - // 删除dom事件 - function deleteDomEvent(node, type, handler) { - if (node.removeEventListener) { - node.removeEventListener(type, handler, false); - } else { - node.detachEvent(type, handler); + //删除所有监听器 + if (isRemoveAll) { + deleteDomEvent(this.node, type, INNER_HANDLER_CACHE[eventId][type]); + delete USER_HANDLER_CACHE[eventId][type]; + delete INNER_HANDLER_CACHE[eventId][type]; + } + return this; } - } - // 触发dom事件 - function triggerDomEvent(node, type, params) { - var event = new CustomEvent(type, { - bubbles: true, - cancelable: true - }); - event._kityParam = params; - node.dispatchEvent(event); - } - // 发送消息 - function sendMessage(messageObj, type, msg) { - var event = null, handler = null; - try { - handler = INNER_HANDLER_CACHE[messageObj._EVNET_UID][type]; - if (!handler) { - return; + // 执行绑定, 该方法context为shape或者mixin了eventhandler的对象 + function listen(node, type, handler, isOnce) { + var eid = this._EVNET_UID, targetObject = this; + // 初始化内部监听器 + if (!INNER_HANDLER_CACHE[eid]) { + INNER_HANDLER_CACHE[eid] = {}; + } + if (!INNER_HANDLER_CACHE[eid][type]) { + // 内部监听器 + INNER_HANDLER_CACHE[eid][type] = function(e) { + e = new ShapeEvent(e || window.event); + Utils.each(USER_HANDLER_CACHE[eid][type], function(fn) { + var result; + if (fn) { + result = fn.call(targetObject, e); + //once 绑定, 执行完后删除 + if (isOnce) { + targetObject.off(type, fn); + } + } + // 如果用户handler里return了false, 则该节点上的此后的同类型事件将不再执行 + return result; + }, targetObject); + }; + } + // 初始化用户监听器列表 + if (!USER_HANDLER_CACHE[eid]) { + USER_HANDLER_CACHE[eid] = {}; + } + if (!USER_HANDLER_CACHE[eid][type]) { + USER_HANDLER_CACHE[eid][type] = [ handler ]; + // 绑定对应类型的事件 + // dom对象利用dom event进行处理, 非dom对象, 由消息分发机制处理 + if (!!node) { + bindDomEvent(node, type, INNER_HANDLER_CACHE[eid][type]); + } + } else { + USER_HANDLER_CACHE[eid][type].push(handler); } - } catch (exception) { - return; } - event = Utils.extend({ - type: type, - target: messageObj - }, msg || {}); - handler.call(messageObj, event); - } - // 对外接口 - return require("core/class").createClass("EventHandler", { - constructor: function() { - this._EVNET_UID = ++guid; - }, - addEventListener: function(type, handler) { - return _addEvent.call(this, type, handler, false); - }, - addOnceEventListener: function(type, handler) { - return _addEvent.call(this, type, handler, true); - }, - removeEventListener: function(type, handler) { - return _removeEvent.call(this, type, handler); - }, - on: function(type, handler) { - return this.addEventListener.apply(this, arguments); - }, - once: function(type, handler) { - return this.addOnceEventListener.apply(this, arguments); - }, - off: function() { - return this.removeEventListener.apply(this, arguments); - }, - fire: function(type, params) { - return this.trigger.apply(this, arguments); - }, - trigger: function(type, params) { - if (this.node) { - triggerDomEvent(this.node, type, params); + // 绑定dom事件 + function bindDomEvent(node, type, handler) { + if (node.addEventListener) { + node.addEventListener(type, handler, false); } else { - sendMessage(this, type, params); + node.attachEvent("on" + type, handler); } - return this; } - }); -}); -define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graphic/vector", "graphic/matrix", "graphic/box" ], function(require) { - var utils = require("core/utils"); - var Point = require("graphic/point"); - var Vector = require("graphic/vector"); - var Matrix = require("graphic/matrix"); - var g = {}; - var pathCommand = /([achlmrqstvz])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?\s*)+)/gi, pathValues = /(-?\d*\.?\d*(?:e[\-+]?\d+)?)\s*,?\s*/gi, paramCounts = { - a: 7, - c: 6, - h: 1, - l: 2, - m: 2, - q: 4, - s: 4, - t: 2, - v: 1, - z: 0 - }; - function pathClone(path) { - var result, i, j, segment, segmentCopy; - result = []; - for (i = 0; i < path.length; i++) { - segment = path[i]; - result.push(segmentCopy = []); - for (j = 0; j < segment.length; j++) { - segmentCopy.push(segment[j]); + // 删除dom事件 + function deleteDomEvent(node, type, handler) { + if (node.removeEventListener) { + node.removeEventListener(type, handler, false); + } else { + node.detachEvent(type, handler); } } - if (path.isUniform) result.isUniform = true; - if (path.isAbsolute) result.isAbsolute = true; - if (path.isCurve) result.isCurve = true; - return result; + // 触发dom事件 + function triggerDomEvent(node, type, params) { + var event = new CustomEvent(type, { + bubbles: true, + cancelable: true + }); + event._kityParam = params; + node.dispatchEvent(event); + } + // 发送消息 + function sendMessage(messageObj, type, msg) { + var event = null, handler = null; + try { + handler = INNER_HANDLER_CACHE[messageObj._EVNET_UID][type]; + if (!handler) { + return; + } + } catch (exception) { + return; + } + event = Utils.extend({ + type: type, + target: messageObj + }, msg || {}); + handler.call(messageObj, event); + } + // 对外接口 + return _p.r(11).createClass("EventHandler", { + constructor: function() { + this._EVNET_UID = ++guid; + }, + addEventListener: function(type, handler) { + return _addEvent.call(this, type, handler, false); + }, + addOnceEventListener: function(type, handler) { + return _addEvent.call(this, type, handler, true); + }, + removeEventListener: function(type, handler) { + return _removeEvent.call(this, type, handler); + }, + on: function(type, handler) { + return this.addEventListener.apply(this, arguments); + }, + once: function(type, handler) { + return this.addOnceEventListener.apply(this, arguments); + }, + off: function() { + return this.removeEventListener.apply(this, arguments); + }, + fire: function(type, params) { + return this.trigger.apply(this, arguments); + }, + trigger: function(type, params) { + if (this.node) { + triggerDomEvent(this.node, type, params); + } else { + sendMessage(this, type, params); + } + return this; + } + }); } - // 缓存函数 - // from raphael.js - function cacher(f, scope, postprocessor) { - function repush(array, item) { - for (var i = 0, ii = array.length; i < ii; i++) if (array[i] === item) { - return array.push(array.splice(i, 1)[0]); +}; + +//src/graphic/geometry.js +_p[35] = { + value: function(require) { + var utils = _p.r(12); + var Point = _p.r(51); + var Vector = _p.r(74); + var Matrix = _p.r(44); + var g = {}; + var pathCommand = /([achlmrqstvz])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?\s*)+)/gi, pathValues = /(-?\d*\.?\d*(?:e[\-+]?\d+)?)\s*,?\s*/gi, paramCounts = { + a: 7, + c: 6, + h: 1, + l: 2, + m: 2, + q: 4, + s: 4, + t: 2, + v: 1, + z: 0 + }; + function pathClone(path) { + var result, i, j, segment, segmentCopy; + result = []; + for (i = 0; i < path.length; i++) { + segment = path[i]; + result.push(segmentCopy = []); + for (j = 0; j < segment.length; j++) { + segmentCopy.push(segment[j]); + } } + if (path.isUniform) result.isUniform = true; + if (path.isAbsolute) result.isAbsolute = true; + if (path.isCurve) result.isCurve = true; + return result; } - function newf() { - var arg = Array.prototype.slice.call(arguments, 0), args = arg.join("␀"), cache = newf.cache = newf.cache || {}, count = newf.count = newf.count || []; - if (cache.hasOwnProperty(args)) { - repush(count, args); - return postprocessor ? postprocessor(cache[args]) : cache[args]; + // 缓存函数 + // from raphael.js + function cacher(f, scope, postprocessor) { + function repush(array, item) { + for (var i = 0, ii = array.length; i < ii; i++) if (array[i] === item) { + return array.push(array.splice(i, 1)[0]); + } } - if (count.length >= 1e3) { - delete cache[count.shift()]; + function newf() { + var arg = Array.prototype.slice.call(arguments, 0), args = arg.join("␀"), cache = newf.cache = newf.cache || {}, count = newf.count = newf.count || []; + if (cache.hasOwnProperty(args)) { + repush(count, args); + return postprocessor ? postprocessor(cache[args]) : cache[args]; + } + if (count.length >= 1e3) { + delete cache[count.shift()]; + } + count.push(args); + cache[args] = f.apply(scope, arg); + return postprocessor ? postprocessor(cache[args]) : cache[args]; } - count.push(args); - cache[args] = f.apply(scope, arg); - return postprocessor ? postprocessor(cache[args]) : cache[args]; + return newf; } - return newf; - } - /** + /** * * kity.g.pathToString(pathSegment) * @@ -4103,17 +4368,17 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * var pathString = kity.g.pathToString(pathSegment); * // 返回 'M0,0L10,10' */ - g.pathToString = function(pathSegment) { - pathSegment = pathSegment || this; - if (typeof pathSegment == "string") return pathSegment; - if (pathSegment instanceof Array) { - pathSegment = utils.flatten(pathSegment); - return pathSegment.join(",").replace(/,?([achlmqrstvxz]),?/gi, "$1"); - } - }; - /** - * kity.g.parsePathString(pathString) - * + g.pathToString = function(pathSegment) { + pathSegment = pathSegment || this; + if (typeof pathSegment == "string") return pathSegment; + if (pathSegment instanceof Array) { + pathSegment = utils.flatten(pathSegment); + return pathSegment.join(",").replace(/,?([achlmqrstvxz]),?/gi, "$1"); + } + }; + /** + * kity.g.parsePathString(pathString) + * * 解析 Path 字符串成 PathSegment * * @copyright rapheal.js @@ -4126,34 +4391,34 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * @param {String} pathString Path 字符串 * @return {Array} */ - g.parsePathString = cacher(function(pathString) { - var data = []; - pathString.replace(pathCommand, function(a, b, c) { - var params = [], name = b.toLowerCase(); - c.replace(pathValues, function(a, b) { - if (b) params.push(+b); - }); - if (name == "m" && params.length > 2) { - data.push([ b ].concat(params.splice(0, 2))); - name = "l"; - b = b == "m" ? "l" : "L"; - } - if (name == "r") { - data.push([ b ].concat(params)); - } else { - while (params.length >= paramCounts[name]) { - data.push([ b ].concat(params.splice(0, paramCounts[name]))); - if (!paramCounts[name]) { - break; + g.parsePathString = cacher(function(pathString) { + var data = []; + pathString.replace(pathCommand, function(a, b, c) { + var params = [], name = b.toLowerCase(); + c.replace(pathValues, function(a, b) { + if (b) params.push(+b); + }); + if (name == "m" && params.length > 2) { + data.push([ b ].concat(params.splice(0, 2))); + name = "l"; + b = b == "m" ? "l" : "L"; + } + if (name == "r") { + data.push([ b ].concat(params)); + } else { + while (params.length >= paramCounts[name]) { + data.push([ b ].concat(params.splice(0, paramCounts[name]))); + if (!paramCounts[name]) { + break; + } } } - } + }); + data.isUniform = true; + data.toString = g.pathToString; + return data; }); - data.isUniform = true; - data.toString = g.pathToString; - return data; - }); - /** + /** * kity.g.pathToAbsolute(path) * * 把路径转换为绝对路径的形式 @@ -4170,181 +4435,181 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * var absPath = kity.g.pathToAbsolute(path); * // 返回 [['M', 10, 10], ['L', 60, 60]] */ - g.pathToAbsolute = cacher(function(path) { - var pathArray = path.isUniform ? path : g.parsePathString(g.pathToString(path)); - var res = [], x = 0, y = 0, mx = 0, my = 0, start = 0; - var r, pa, i, j, k, ii, jj, kk; - if (pathArray[0][0] == "M") { - x = +pathArray[0][1]; - y = +pathArray[0][2]; - mx = x; - my = y; - start++; - res[0] = [ "M", x, y ]; - } - for (r, pa, i = start, ii = pathArray.length; i < ii; i++) { - res.push(r = []); - pa = pathArray[i]; - if (pa[0] != pa[0].toUpperCase()) { - r[0] = pa[0].toUpperCase(); + g.pathToAbsolute = cacher(function(path) { + var pathArray = path.isUniform ? path : g.parsePathString(g.pathToString(path)); + var res = [], x = 0, y = 0, mx = 0, my = 0, start = 0; + var r, pa, i, j, k, ii, jj, kk; + if (pathArray[0][0] == "M") { + x = +pathArray[0][1]; + y = +pathArray[0][2]; + mx = x; + my = y; + start++; + res[0] = [ "M", x, y ]; + } + for (r, pa, i = start, ii = pathArray.length; i < ii; i++) { + res.push(r = []); + pa = pathArray[i]; + if (pa[0] != pa[0].toUpperCase()) { + r[0] = pa[0].toUpperCase(); + switch (r[0]) { + case "A": + r[1] = pa[1]; + r[2] = pa[2]; + r[3] = pa[3]; + r[4] = pa[4]; + r[5] = pa[5]; + r[6] = +(pa[6] + x); + r[7] = +(pa[7] + y); + break; + + case "V": + r[1] = +pa[1] + y; + break; + + case "H": + r[1] = +pa[1] + x; + break; + + case "M": + mx = +pa[1] + x; + my = +pa[2] + y; + break; + + default: + for (j = 1, jj = pa.length; j < jj; j++) { + r[j] = +pa[j] + (j % 2 ? x : y); + } + } + } else { + for (k = 0, kk = pa.length; k < kk; k++) { + r[k] = pa[k]; + } + } switch (r[0]) { - case "A": - r[1] = pa[1]; - r[2] = pa[2]; - r[3] = pa[3]; - r[4] = pa[4]; - r[5] = pa[5]; - r[6] = +(pa[6] + x); - r[7] = +(pa[7] + y); + case "Z": + x = mx; + y = my; break; - case "V": - r[1] = +pa[1] + y; + case "H": + x = r[1]; break; - case "H": - r[1] = +pa[1] + x; + case "V": + y = r[1]; break; case "M": - mx = +pa[1] + x; - my = +pa[2] + y; + mx = r[r.length - 2]; + my = r[r.length - 1]; break; default: - for (j = 1, jj = pa.length; j < jj; j++) { - r[j] = +pa[j] + (j % 2 ? x : y); - } + x = r[r.length - 2]; + y = r[r.length - 1]; } - } else { - for (k = 0, kk = pa.length; k < kk; k++) { - r[k] = pa[k]; - } - } - switch (r[0]) { - case "Z": - x = mx; - y = my; - break; - - case "H": - x = r[1]; - break; - - case "V": - y = r[1]; - break; - - case "M": - mx = r[r.length - 2]; - my = r[r.length - 1]; - break; - - default: - x = r[r.length - 2]; - y = r[r.length - 1]; } - } - res.isUniform = true; - res.isAbsolute = true; - res.toString = g.pathToString; - return res; - }); - // 把圆弧绘制的曲线转化为对应的三次贝塞尔形式 - function a2c(x1, y1, rx, ry, angle, laf, sf, x2, y2, recursive) { - // copy from raphael.js - // for more information of where this math came from visit: - // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes - var math = Math, PI = math.PI, abs = Math.abs, _120 = PI * 120 / 180, rad = PI / 180 * (+angle || 0), res = [], xy, rotate = function(x, y, rad) { - var X = x * math.cos(rad) - y * math.sin(rad), Y = x * math.sin(rad) + y * math.cos(rad); - return { - x: X, - y: Y + res.isUniform = true; + res.isAbsolute = true; + res.toString = g.pathToString; + return res; + }); + // 把圆弧绘制的曲线转化为对应的三次贝塞尔形式 + function a2c(x1, y1, rx, ry, angle, laf, sf, x2, y2, recursive) { + // copy from raphael.js + // for more information of where this math came from visit: + // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes + var math = Math, PI = math.PI, abs = Math.abs, _120 = PI * 120 / 180, rad = PI / 180 * (+angle || 0), res = [], xy, rotate = function(x, y, rad) { + var X = x * math.cos(rad) - y * math.sin(rad), Y = x * math.sin(rad) + y * math.cos(rad); + return { + x: X, + y: Y + }; }; - }; - var cos, sin, h, x, y, rx2, ry2, k, cx, cy, f1, f2, df, f2old, x2old, y2old, c1, s1, c2, s2, t, hx, hy, m1, m2, m3, m4, newres, i, ii; - if (!recursive) { - xy = rotate(x1, y1, -rad); - x1 = xy.x; - y1 = xy.y; - xy = rotate(x2, y2, -rad); - x2 = xy.x; - y2 = xy.y; - cos = math.cos(PI / 180 * angle); - sin = math.sin(PI / 180 * angle); - x = (x1 - x2) / 2; - y = (y1 - y2) / 2; - h = x * x / (rx * rx) + y * y / (ry * ry); - if (h > 1) { - h = math.sqrt(h); - rx = h * rx; - ry = h * ry; - } - rx2 = rx * rx; - ry2 = ry * ry; - k = (laf == sf ? -1 : 1) * math.sqrt(abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))); - cx = k * rx * y / ry + (x1 + x2) / 2; - cy = k * -ry * x / rx + (y1 + y2) / 2; - f1 = math.asin(((y1 - cy) / ry).toFixed(9)); - f2 = math.asin(((y2 - cy) / ry).toFixed(9)); - f1 = x1 < cx ? PI - f1 : f1; - f2 = x2 < cx ? PI - f2 : f2; - if (f1 < 0) f1 = PI * 2 + f1; - if (f2 < 0) f2 = PI * 2 + f2; - if (sf && f1 > f2) { - f1 = f1 - PI * 2; - } - if (!sf && f2 > f1) { - f2 = f2 - PI * 2; + var cos, sin, h, x, y, rx2, ry2, k, cx, cy, f1, f2, df, f2old, x2old, y2old, c1, s1, c2, s2, t, hx, hy, m1, m2, m3, m4, newres, i, ii; + if (!recursive) { + xy = rotate(x1, y1, -rad); + x1 = xy.x; + y1 = xy.y; + xy = rotate(x2, y2, -rad); + x2 = xy.x; + y2 = xy.y; + cos = math.cos(PI / 180 * angle); + sin = math.sin(PI / 180 * angle); + x = (x1 - x2) / 2; + y = (y1 - y2) / 2; + h = x * x / (rx * rx) + y * y / (ry * ry); + if (h > 1) { + h = math.sqrt(h); + rx = h * rx; + ry = h * ry; + } + rx2 = rx * rx; + ry2 = ry * ry; + k = (laf == sf ? -1 : 1) * math.sqrt(abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))); + cx = k * rx * y / ry + (x1 + x2) / 2; + cy = k * -ry * x / rx + (y1 + y2) / 2; + f1 = math.asin(((y1 - cy) / ry).toFixed(9)); + f2 = math.asin(((y2 - cy) / ry).toFixed(9)); + f1 = x1 < cx ? PI - f1 : f1; + f2 = x2 < cx ? PI - f2 : f2; + if (f1 < 0) f1 = PI * 2 + f1; + if (f2 < 0) f2 = PI * 2 + f2; + if (sf && f1 > f2) { + f1 = f1 - PI * 2; + } + if (!sf && f2 > f1) { + f2 = f2 - PI * 2; + } + } else { + f1 = recursive[0]; + f2 = recursive[1]; + cx = recursive[2]; + cy = recursive[3]; + } + df = f2 - f1; + if (abs(df) > _120) { + f2old = f2; + x2old = x2; + y2old = y2; + f2 = f1 + _120 * (sf && f2 > f1 ? 1 : -1); + x2 = cx + rx * math.cos(f2); + y2 = cy + ry * math.sin(f2); + res = a2c(x2, y2, rx, ry, angle, 0, sf, x2old, y2old, [ f2, f2old, cx, cy ]); + } + df = f2 - f1; + c1 = math.cos(f1); + s1 = math.sin(f1); + c2 = math.cos(f2); + s2 = math.sin(f2); + t = math.tan(df / 4); + hx = 4 / 3 * rx * t; + hy = 4 / 3 * ry * t; + m1 = [ x1, y1 ]; + m2 = [ x1 + hx * s1, y1 - hy * c1 ]; + m3 = [ x2 + hx * s2, y2 - hy * c2 ]; + m4 = [ x2, y2 ]; + m2[0] = 2 * m1[0] - m2[0]; + m2[1] = 2 * m1[1] - m2[1]; + if (recursive) { + return [ m2, m3, m4 ].concat(res); + } else { + res = [ m2, m3, m4 ].concat(res).join().split(","); + newres = []; + for (i = 0, ii = res.length; i < ii; i++) { + newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x; + } + return newres; } - } else { - f1 = recursive[0]; - f2 = recursive[1]; - cx = recursive[2]; - cy = recursive[3]; - } - df = f2 - f1; - if (abs(df) > _120) { - f2old = f2; - x2old = x2; - y2old = y2; - f2 = f1 + _120 * (sf && f2 > f1 ? 1 : -1); - x2 = cx + rx * math.cos(f2); - y2 = cy + ry * math.sin(f2); - res = a2c(x2, y2, rx, ry, angle, 0, sf, x2old, y2old, [ f2, f2old, cx, cy ]); } - df = f2 - f1; - c1 = math.cos(f1); - s1 = math.sin(f1); - c2 = math.cos(f2); - s2 = math.sin(f2); - t = math.tan(df / 4); - hx = 4 / 3 * rx * t; - hy = 4 / 3 * ry * t; - m1 = [ x1, y1 ]; - m2 = [ x1 + hx * s1, y1 - hy * c1 ]; - m3 = [ x2 + hx * s2, y2 - hy * c2 ]; - m4 = [ x2, y2 ]; - m2[0] = 2 * m1[0] - m2[0]; - m2[1] = 2 * m1[1] - m2[1]; - if (recursive) { - return [ m2, m3, m4 ].concat(res); - } else { - res = [ m2, m3, m4 ].concat(res).join().split(","); - newres = []; - for (i = 0, ii = res.length; i < ii; i++) { - newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x; - } - return newres; + // 把二次贝塞尔曲线参数转化为三次贝塞尔曲线参数 + function q2c(x1, y1, ax, ay, x2, y2) { + // copy from raphael.js + var _13 = 1 / 3, _23 = 2 / 3; + return [ _13 * x1 + _23 * ax, _13 * y1 + _23 * ay, _13 * x2 + _23 * ax, _13 * y2 + _23 * ay, x2, y2 ]; } - } - // 把二次贝塞尔曲线参数转化为三次贝塞尔曲线参数 - function q2c(x1, y1, ax, ay, x2, y2) { - // copy from raphael.js - var _13 = 1 / 3, _23 = 2 / 3; - return [ _13 * x1 + _23 * ax, _13 * y1 + _23 * ay, _13 * x2 + _23 * ax, _13 * y2 + _23 * ay, x2, y2 ]; - } - /** + /** * kity.g.pathToCurve(path) * * 把路径转换为贝塞尔路径 @@ -4355,124 +4620,124 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * @return {Array} * 转换后的 PathSegment,每一段都是 'C' */ - g.pathToCurve = cacher(function(path) { - var i, j, command, param; - var initPoint, currentPoint, endPoint, shouldClose, lastControlPoint, aussumedControlPoint; - var controlPoint1, controlPoint2; - var res = []; - // 处理的路径要求是一个绝对路径 - if (!path.isAbsolute) path = g.pathToAbsolute(path); - for (i = 0; i < path.length; i++) { - command = path[i][0]; - param = path[i].slice(1); - // 画笔移动 - if (command == "M") { - initPoint = lastControlPoint = currentPoint = param; - res.push(path[i]); - continue; - } - // 路径闭合 - if (command == "Z") { - shouldClose = true; - command = "L"; - param = initPoint; - } - // 绘制命令的目的位置 - endPoint = param.slice(param.length - 2); - // 对 'H' 命令的修正 - if (command == "H") { - endPoint = [ param[0], currentPoint[1] ]; - command = "L"; - } - // 对 'V' 命令的修正 - if (command == "V") { - endPoint = [ currentPoint[0], param[0] ]; - command = "L"; - } - // 对 'S' 命令求出隐含的控制点位置 - if (command == "S" || command == "T") { - // 隐含控制点是上一个控制点关于当前位置的镜像 - aussumedControlPoint = [ currentPoint[0] + (currentPoint[0] - lastControlPoint[0]), currentPoint[1] + (currentPoint[1] - lastControlPoint[1]) ]; - } - // 针对不同的命令求控制点 - switch (command) { - case "L": - controlPoint1 = currentPoint; - controlPoint2 = endPoint; - break; + g.pathToCurve = cacher(function(path) { + var i, j, command, param; + var initPoint, currentPoint, endPoint, shouldClose, lastControlPoint, aussumedControlPoint; + var controlPoint1, controlPoint2; + var res = []; + // 处理的路径要求是一个绝对路径 + if (!path.isAbsolute) path = g.pathToAbsolute(path); + for (i = 0; i < path.length; i++) { + command = path[i][0]; + param = path[i].slice(1); + // 画笔移动 + if (command == "M") { + initPoint = lastControlPoint = currentPoint = param; + res.push(path[i]); + continue; + } + // 路径闭合 + if (command == "Z") { + shouldClose = true; + command = "L"; + param = initPoint; + } + // 绘制命令的目的位置 + endPoint = param.slice(param.length - 2); + // 对 'H' 命令的修正 + if (command == "H") { + endPoint = [ param[0], currentPoint[1] ]; + command = "L"; + } + // 对 'V' 命令的修正 + if (command == "V") { + endPoint = [ currentPoint[0], param[0] ]; + command = "L"; + } + // 对 'S' 命令求出隐含的控制点位置 + if (command == "S" || command == "T") { + // 隐含控制点是上一个控制点关于当前位置的镜像 + aussumedControlPoint = [ currentPoint[0] + (currentPoint[0] - lastControlPoint[0]), currentPoint[1] + (currentPoint[1] - lastControlPoint[1]) ]; + } + // 针对不同的命令求控制点 + switch (command) { + case "L": + controlPoint1 = currentPoint; + controlPoint2 = endPoint; + break; - case "C": - controlPoint1 = param.slice(0, 2); - controlPoint2 = param.slice(2, 4); - break; + case "C": + controlPoint1 = param.slice(0, 2); + controlPoint2 = param.slice(2, 4); + break; - case "S": - controlPoint1 = aussumedControlPoint.slice(); - controlPoint2 = param.slice(0, 2); - break; + case "S": + controlPoint1 = aussumedControlPoint.slice(); + controlPoint2 = param.slice(0, 2); + break; - case "Q": - lastControlPoint = param.slice(0, 2); - param = q2c.apply(null, currentPoint.concat(param)); - controlPoint1 = param.slice(0, 2); - controlPoint2 = param.slice(2, 4); - break; + case "Q": + lastControlPoint = param.slice(0, 2); + param = q2c.apply(null, currentPoint.concat(param)); + controlPoint1 = param.slice(0, 2); + controlPoint2 = param.slice(2, 4); + break; - case "T": - param = q2c.apply(null, currentPoint.concat(aussumedControlPoint).concat(param)); - controlPoint1 = param.slice(0, 2); - controlPoint2 = param.slice(2, 4); - break; + case "T": + param = q2c.apply(null, currentPoint.concat(aussumedControlPoint).concat(param)); + controlPoint1 = param.slice(0, 2); + controlPoint2 = param.slice(2, 4); + break; - case "A": - param = a2c.apply(null, currentPoint.concat(param)); - j = 0; - while (j in param) { - controlPoint1 = param.slice(j, j + 2); - controlPoint2 = param.slice(j + 2, j + 4); - endPoint = param.slice(j + 4, j + 6); + case "A": + param = a2c.apply(null, currentPoint.concat(param)); + j = 0; + while (j in param) { + controlPoint1 = param.slice(j, j + 2); + controlPoint2 = param.slice(j + 2, j + 4); + endPoint = param.slice(j + 4, j + 6); + // 写入当前一段曲线 + res.push([ "C" ].concat(controlPoint1).concat(controlPoint2).concat(endPoint)); + j += 6; + } + break; + } + if (command != "A") { // 写入当前一段曲线 res.push([ "C" ].concat(controlPoint1).concat(controlPoint2).concat(endPoint)); - j += 6; } - break; - } - if (command != "A") { - // 写入当前一段曲线 - res.push([ "C" ].concat(controlPoint1).concat(controlPoint2).concat(endPoint)); - } - // 为下次循环准备当前位置 - currentPoint = endPoint; - // 二次贝塞尔曲线自己已经记录了上个控制点的位置,其它的记录控制点 2 的位置 - if (command != "Q") { - lastControlPoint = controlPoint2; - } - if (shouldClose) { - res.push([ "Z" ]); - shouldClose = false; + // 为下次循环准备当前位置 + currentPoint = endPoint; + // 二次贝塞尔曲线自己已经记录了上个控制点的位置,其它的记录控制点 2 的位置 + if (command != "Q") { + lastControlPoint = controlPoint2; + } + if (shouldClose) { + res.push([ "Z" ]); + shouldClose = false; + } } - } - res.isUniform = true; - res.isAbsolute = true; - res.isCurve = true; - res.toString = g.pathToString; - return res; - }); - /** + res.isUniform = true; + res.isAbsolute = true; + res.isCurve = true; + res.toString = g.pathToString; + return res; + }); + /** * 将贝塞尔曲线切成两部分 * * @see http://stackoverflow.com/questions/18655135/divide-bezier-curve-into-two-equal-halves */ - function cutBezier(bezierArray, t) { - function __(t) { - return function(p, q) { - return p + t * (q - p); - }; + function cutBezier(bezierArray, t) { + function __(t) { + return function(p, q) { + return p + t * (q - p); + }; + } + var _ = __(t || .5), ba = bezierArray, ax = ba[0], ay = ba[1], bx = ba[2], by = ba[3], cx = ba[4], cy = ba[5], dx = ba[6], dy = ba[7], ex = _(ax, bx), ey = _(ay, by), fx = _(bx, cx), fy = _(by, cy), gx = _(cx, dx), gy = _(cy, dy), hx = _(ex, fx), hy = _(ey, fy), jx = _(fx, gx), jy = _(fy, gy), kx = _(hx, jx), ky = _(hy, jy); + return [ [ ax, ay, ex, ey, hx, hy, kx, ky ], [ kx, ky, jx, jy, gx, gy, dx, dy ] ]; } - var _ = __(t || .5), ba = bezierArray, ax = ba[0], ay = ba[1], bx = ba[2], by = ba[3], cx = ba[4], cy = ba[5], dx = ba[6], dy = ba[7], ex = _(ax, bx), ey = _(ay, by), fx = _(bx, cx), fy = _(by, cy), gx = _(cx, dx), gy = _(cy, dy), hx = _(ex, fx), hy = _(ey, fy), jx = _(fx, gx), jy = _(fy, gy), kx = _(hx, jx), ky = _(hy, jy); - return [ [ ax, ay, ex, ey, hx, hy, kx, ky ], [ kx, ky, jx, jy, gx, gy, dx, dy ] ]; - } - /** + /** * kity.g.cutBezier(bezierArray, t) * * 在指定位置把贝塞尔曲线切割为两部分 @@ -4491,8 +4756,8 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * ] * */ - g.cutBezier = cacher(cutBezier); - /** + g.cutBezier = cacher(cutBezier); + /** * 求一段贝塞尔曲线的子段 * * @param {Array} bezierArray @@ -4507,11 +4772,11 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * @return {Array} * 长度为 8 的数组,表示给定贝塞尔曲线的子段 */ - g.subBezier = function(bezierArray, t, t0) { - var b2t = cutBezier(bezierArray, t)[0]; - return t0 ? cutBezier(b2t, t0 / t)[1] : b2t; - }; - /** + g.subBezier = function(bezierArray, t, t0) { + var b2t = cutBezier(bezierArray, t)[0]; + return t0 ? cutBezier(b2t, t0 / t)[1] : b2t; + }; + /** * 求贝塞尔曲线上的一个点 * * @param {Array} bezierArray @@ -4525,17 +4790,17 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * p.y: y 坐标 * p.tan: 在 t 处的切线方向(类型为 kity.Vector,模为 1) */ - g.pointAtBezier = function(bezierArray, t) { - var b2t = cutBezier(bezierArray, t)[0]; - var p = Point.parse(b2t.slice(6)), c = Point.parse(b2t.slice(4, 2)), v = Vector.fromPoints(c, p); - if (t === 0) { - p.tan = g.pointAtBezier(bezierArray, .01).tan; - } else { - p.tan = v.normalize(); - } - return p; - }; - /** + g.pointAtBezier = function(bezierArray, t) { + var b2t = cutBezier(bezierArray, t)[0]; + var p = Point.parse(b2t.slice(6)), c = Point.parse(b2t.slice(4, 2)), v = Vector.fromPoints(c, p); + if (t === 0) { + p.tan = g.pointAtBezier(bezierArray, .01).tan; + } else { + p.tan = v.normalize(); + } + return p; + }; + /** * 求贝塞尔曲线的长度 * * @param {Array} bezierArray @@ -4546,66 +4811,66 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * * @return {Number} 贝塞尔曲线的长度 */ - g.bezierLength = cacher(function bezierLength(bezierArray) { - // 表示(c[0]*t^4 + c[1]*t^3 + c[2]*t^2 + c[3]*t^1 + c[4])^(1/2)的函数 - function f(x) { - var m = c0 * Math.pow(x, 4) + c1 * Math.pow(x, 3) + c2 * Math.pow(x, 2) + c3 * x + c4; - if (m < 0) { - m = 0; - } - return Math.pow(m, .5); - } - // 用Newton-Cotes型求积公式 - var arr = bezierArray; - // 三次贝塞尔曲线函数求导后,求出对应的方程系数,用cx[],cy[]表示x`(t)和y`(t)的系数 - var cx0, cx1, cx2; - var cy0, cy1, cy2; - // 用c[]表示x`(t)^2 + y`(t)^2的结果的系数 - var c0, c1, c2, c3, c4; - // 求x`(t) 和 y`(t)的系数 - cx0 = -3 * arr[0] + 9 * arr[2] - 9 * arr[4] + 3 * arr[6]; - cx1 = 6 * arr[0] - 12 * arr[2] + 6 * arr[4]; - cx2 = -3 * arr[0] + 3 * arr[2]; - cy0 = -3 * arr[1] + 9 * arr[3] - 9 * arr[5] + 3 * arr[7]; - cy1 = 6 * arr[1] - 12 * arr[3] + 6 * arr[5]; - cy2 = -3 * arr[1] + 3 * arr[3]; - // 求x`(t)^2 + y`(t)^2的结果的系数 c[] - c0 = Math.pow(cx0, 2) + Math.pow(cy0, 2); - c1 = 2 * (cx0 * cx1 + cy0 * cy1); - c2 = 2 * (cx0 * cx2 + cy0 * cy2) + Math.pow(cx1, 2) + Math.pow(cy1, 2); - c3 = 2 * (cx1 * cx2 + cy1 * cy2); - c4 = Math.pow(cx2, 2) + Math.pow(cy2, 2); - // 用cotes积分公式求值 - return (f(0) + f(1) + 4 * (f(.125) + f(.375) + f(.625) + f(.875)) + 2 * (f(.25) + f(.5) + f(.75))) / 24; - }); - // 计算一个 pathSegment 中每一段的在整体中所占的长度范围,以及总长度 - // 方法要求每一段都是贝塞尔曲线 - var getBezierPathSegmentRanges = cacher(function(pathSegment) { - var i, ii, segment, position, bezierLength, segmentRanges, totalLength; - segmentRanges = []; - // 总长度 - totalLength = 0; - for (i = 0, ii = pathSegment.length; i < ii; i++) { - segment = pathSegment[i]; - if (segment[0] == "M") { - position = segment.slice(1); - segmentRanges.push(null); - continue; - } - if (segment[0] == "Z") { - segmentRanges.push(null); - continue; - } - bezierLength = g.bezierLength(position.concat(segment.slice(1))); - segmentRanges.push([ totalLength, totalLength + bezierLength ]); - totalLength += bezierLength; - // 迭代当前位置 - position = segment.slice(4); - } - segmentRanges.totalLength = totalLength; - return segmentRanges; - }); - /** + g.bezierLength = cacher(function bezierLength(bezierArray) { + // 表示(c[0]*t^4 + c[1]*t^3 + c[2]*t^2 + c[3]*t^1 + c[4])^(1/2)的函数 + function f(x) { + var m = c0 * Math.pow(x, 4) + c1 * Math.pow(x, 3) + c2 * Math.pow(x, 2) + c3 * x + c4; + if (m < 0) { + m = 0; + } + return Math.pow(m, .5); + } + // 用Newton-Cotes型求积公式 + var arr = bezierArray; + // 三次贝塞尔曲线函数求导后,求出对应的方程系数,用cx[],cy[]表示x`(t)和y`(t)的系数 + var cx0, cx1, cx2; + var cy0, cy1, cy2; + // 用c[]表示x`(t)^2 + y`(t)^2的结果的系数 + var c0, c1, c2, c3, c4; + // 求x`(t) 和 y`(t)的系数 + cx0 = -3 * arr[0] + 9 * arr[2] - 9 * arr[4] + 3 * arr[6]; + cx1 = 6 * arr[0] - 12 * arr[2] + 6 * arr[4]; + cx2 = -3 * arr[0] + 3 * arr[2]; + cy0 = -3 * arr[1] + 9 * arr[3] - 9 * arr[5] + 3 * arr[7]; + cy1 = 6 * arr[1] - 12 * arr[3] + 6 * arr[5]; + cy2 = -3 * arr[1] + 3 * arr[3]; + // 求x`(t)^2 + y`(t)^2的结果的系数 c[] + c0 = Math.pow(cx0, 2) + Math.pow(cy0, 2); + c1 = 2 * (cx0 * cx1 + cy0 * cy1); + c2 = 2 * (cx0 * cx2 + cy0 * cy2) + Math.pow(cx1, 2) + Math.pow(cy1, 2); + c3 = 2 * (cx1 * cx2 + cy1 * cy2); + c4 = Math.pow(cx2, 2) + Math.pow(cy2, 2); + // 用cotes积分公式求值 + return (f(0) + f(1) + 4 * (f(.125) + f(.375) + f(.625) + f(.875)) + 2 * (f(.25) + f(.5) + f(.75))) / 24; + }); + // 计算一个 pathSegment 中每一段的在整体中所占的长度范围,以及总长度 + // 方法要求每一段都是贝塞尔曲线 + var getBezierPathSegmentRanges = cacher(function(pathSegment) { + var i, ii, segment, position, bezierLength, segmentRanges, totalLength; + segmentRanges = []; + // 总长度 + totalLength = 0; + for (i = 0, ii = pathSegment.length; i < ii; i++) { + segment = pathSegment[i]; + if (segment[0] == "M") { + position = segment.slice(1); + segmentRanges.push(null); + continue; + } + if (segment[0] == "Z") { + segmentRanges.push(null); + continue; + } + bezierLength = g.bezierLength(position.concat(segment.slice(1))); + segmentRanges.push([ totalLength, totalLength + bezierLength ]); + totalLength += bezierLength; + // 迭代当前位置 + position = segment.slice(4); + } + segmentRanges.totalLength = totalLength; + return segmentRanges; + }); + /** * 求一段路径的子路径 * * @param {Array|String} path @@ -4620,100 +4885,100 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * @return {Array} * 子路径的 PathSegment */ - g.subPath = function(path, t1, t0) { - var dt; - t0 = t0 || 0; - dt = t1 - t0; - dt = dt - (dt | 0); - t0 = t0 - (t0 | 0); - t1 = t0 + dt; - if (t1 > 1) { - return g.subPath(path, 1, t0).concat(g.subPath(path, t1 - 1)); - } - if (!path.isCurve) { - path = g.pathToCurve(path); - } - // path 每一段在整体中的长度区间 - var segmentRanges = getBezierPathSegmentRanges(path); - // path 总长度 - var totalLength = segmentRanges.totalLength; - // t1 和 t0 位置命中的长度位置 - var t1Length = totalLength * t1, t0Length = totalLength * (t0 || 0); - // 产生的子路径 - var subPath = []; - // 迭代变量,a 是一段的长度区间左值,b 是右值,d 是区间长度 - var i, ii, a, b, d; - var position; - var bezier, subBezier, stared; - for (i = 0, ii = path.length; i < ii; i++) { - if (path[i][0] == "M") { - position = path[i].slice(1); - if (stared) { + g.subPath = function(path, t1, t0) { + var dt; + t0 = t0 || 0; + dt = t1 - t0; + dt = dt - (dt | 0); + t0 = t0 - (t0 | 0); + t1 = t0 + dt; + if (t1 > 1) { + return g.subPath(path, 1, t0).concat(g.subPath(path, t1 - 1)); + } + if (!path.isCurve) { + path = g.pathToCurve(path); + } + // path 每一段在整体中的长度区间 + var segmentRanges = getBezierPathSegmentRanges(path); + // path 总长度 + var totalLength = segmentRanges.totalLength; + // t1 和 t0 位置命中的长度位置 + var t1Length = totalLength * t1, t0Length = totalLength * (t0 || 0); + // 产生的子路径 + var subPath = []; + // 迭代变量,a 是一段的长度区间左值,b 是右值,d 是区间长度 + var i, ii, a, b, d; + var position; + var bezier, subBezier, stared; + for (i = 0, ii = path.length; i < ii; i++) { + if (path[i][0] == "M") { + position = path[i].slice(1); + if (stared) { + subPath.push(path[i].slice()); + } + continue; + } + if (path[i][0] == "Z") { + // subpath 路径不闭合 + continue; + } + a = segmentRanges[i][0]; + b = segmentRanges[i][1]; + d = b - a; + bezier = position.concat(path[i].slice(1)); + if (t0Length > b) { + // t0 和 t1 都右溢出 + // ----------------------------------- + // t0 t1 + // |________| + // + // 需要跳过当前块 + position = bezier.slice(bezier.length - 2); + continue; + } else if (t0Length >= a) { + // 命中 t0;t1 可能命中或右溢出 + // ----------------------------------- + // t0 t1 + // |______|__| + // + // or: |_|____|__| + // + // 取当前块 t0 到 t1 的部分 + subBezier = g.subBezier(bezier, Math.min((t1Length - a) / d, 1), (t0Length - a) / d); + stared = true; + position = subBezier.slice(0, 2); + subPath.push([ "M" ].concat(subBezier.slice(0, 2))); + subPath.push([ "C" ].concat(subBezier.slice(2))); + } else if (t1Length >= b) { + // t0 左溢出;t1 右溢出,整个块是需要的 + // ----------------------------------- + // t0 t1 + // |_________| + // + // 此时取整个块 subPath.push(path[i].slice()); + } else if (t1Length >= a) { + // t0 左溢出;t1 命中,取当前块 t1 之前的部分 + // ----------------------------------- + // t0 t1 + // |__|______| + // 取当前块 t1 之前的部分 + subBezier = g.subBezier(bezier, (t1Length - a) / d); + subPath.push([ "C" ].concat(subBezier.slice(2))); + stared = false; + } else { + // 没有可以再要的了 + break; } - continue; - } - if (path[i][0] == "Z") { - // subpath 路径不闭合 - continue; - } - a = segmentRanges[i][0]; - b = segmentRanges[i][1]; - d = b - a; - bezier = position.concat(path[i].slice(1)); - if (t0Length > b) { - // t0 和 t1 都右溢出 - // ----------------------------------- - // t0 t1 - // |________| - // - // 需要跳过当前块 position = bezier.slice(bezier.length - 2); - continue; - } else if (t0Length >= a) { - // 命中 t0;t1 可能命中或右溢出 - // ----------------------------------- - // t0 t1 - // |______|__| - // - // or: |_|____|__| - // - // 取当前块 t0 到 t1 的部分 - subBezier = g.subBezier(bezier, Math.min((t1Length - a) / d, 1), (t0Length - a) / d); - stared = true; - position = subBezier.slice(0, 2); - subPath.push([ "M" ].concat(subBezier.slice(0, 2))); - subPath.push([ "C" ].concat(subBezier.slice(2))); - } else if (t1Length >= b) { - // t0 左溢出;t1 右溢出,整个块是需要的 - // ----------------------------------- - // t0 t1 - // |_________| - // - // 此时取整个块 - subPath.push(path[i].slice()); - } else if (t1Length >= a) { - // t0 左溢出;t1 命中,取当前块 t1 之前的部分 - // ----------------------------------- - // t0 t1 - // |__|______| - // 取当前块 t1 之前的部分 - subBezier = g.subBezier(bezier, (t1Length - a) / d); - subPath.push([ "C" ].concat(subBezier.slice(2))); - stared = false; - } else { - // 没有可以再要的了 - break; } - position = bezier.slice(bezier.length - 2); - } - subPath.isAbsolute = true; - subPath.isCurve = true; - subPath.isUniform = true; - subPath.toString = g.pathToString; - return subPath; - }; - /** + subPath.isAbsolute = true; + subPath.isCurve = true; + subPath.isUniform = true; + subPath.toString = g.pathToString; + return subPath; + }; + /** * 求路径上的一个点 * * @param {Array|String} path @@ -4727,19 +4992,19 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * p.y: y 坐标 * p.tan: 在 t 处的切线方向(类型为 kity.Vector,模为 1) */ - g.pointAtPath = function(path, t) { - if (!path.isCurve) { - path = g.pathToCurve(path); - } - var subPath = g.subPath(path, t); - var lastCurve = subPath[subPath.length - 1][0] == "Z" ? subPath[subPath.length - 2] : subPath[subPath.length - 1]; - // 跳过 'C' 命令,只留参数 - lastCurve = lastCurve.slice(1); - var p = Point.parse(lastCurve.slice(4)), c = Point.parse(lastCurve.slice(2, 4)); - p.tan = Vector.fromPoints(c, p).normalize(); - return p; - }; - /** + g.pointAtPath = function(path, t) { + if (!path.isCurve) { + path = g.pathToCurve(path); + } + var subPath = g.subPath(path, t); + var lastCurve = subPath[subPath.length - 1][0] == "Z" ? subPath[subPath.length - 2] : subPath[subPath.length - 1]; + // 跳过 'C' 命令,只留参数 + lastCurve = lastCurve.slice(1); + var p = Point.parse(lastCurve.slice(4)), c = Point.parse(lastCurve.slice(2, 4)); + p.tan = Vector.fromPoints(c, p).normalize(); + return p; + }; + /** * 求一段路径的长度 * * @param {string|Array} path @@ -4748,15 +5013,15 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * @return {Number} * 路径的长度 */ - g.pathLength = cacher(function(path) { - if (!path.isCurve) { - path = g.pathToCurve(path); - } - // path 每一段在整体中的长度区间 - var segmentRanges = getBezierPathSegmentRanges(path); - return segmentRanges.totalLength; - }); - /** + g.pathLength = cacher(function(path) { + if (!path.isCurve) { + path = g.pathToCurve(path); + } + // path 每一段在整体中的长度区间 + var segmentRanges = getBezierPathSegmentRanges(path); + return segmentRanges.totalLength; + }); + /** * 求一段路径的关键点 * * @param {string|Array} path @@ -4765,91 +5030,91 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * @return {Array} * 关键点的集合 */ - g.pathKeyPoints = cacher(function(path) { - var i, ii, command, keyPoints; - if (!path.isCurve) { - path = g.pathToCurve(path); - } - keyPoints = []; - for (i = 0, ii = path.length; i < ii; i++) { - if (path[i][0] == "z") continue; - keyPoints.push(path[i].slice(path[i].length - 2)); - } - return keyPoints; - }); - // 对比两个路径的关键位置,在合适的位置切割合适的路径,使得两个路径的段数一致 - // TODO: 使用插值算法,使对应点更合理 - var alignCurve = cacher(function(path1, path2) { - if (!path1.isCurve) path1 = g.pathToCurve(path1); - if (!path2.isCurve) path2 = g.pathToCurve(path2); - var p1 = pathClone(path1); - var p2 = pathClone(path2); - p1.i = 0; - p2.i = 0; - p1.o = p2; - p2.o = p1; - function command(p, i) { - return p[i || p.i] && p[i || p.i][0]; - } - function param(p, i) { - return p[i || p.i] && p[i || p.i].slice(1); - } - function point(p, i) { - var _param = param(p, i); - return _param && _param.slice(-2); - } - function fixZ(p) { - if (command(p) == "Z") { - p.splice(p.i, 1); - return true; + g.pathKeyPoints = cacher(function(path) { + var i, ii, command, keyPoints; + if (!path.isCurve) { + path = g.pathToCurve(path); } - return false; - } - function fixM(p) { - if (command(p) == "M") { - p.o.splice(p.o.i, 0, [ "M" ].concat(point(p.o, p.o.i - 1))); - p.i++; - p.o.i++; - return true; - } - return false; - } - function fill(p) { - var lastPoint; - var i = 1; - while (!lastPoint) { - lastPoint = point(p, p.length - i++); - } - p.o.i = p.i; - while (p.length < p.o.length) { - if (fixZ(p.o)) continue; - if (fixM(p.o)) continue; - p.push([ "C" ].concat(lastPoint).concat(lastPoint).concat(lastPoint)); - p.i++; - p.o.i++; + keyPoints = []; + for (i = 0, ii = path.length; i < ii; i++) { + if (path[i][0] == "z") continue; + keyPoints.push(path[i].slice(path[i].length - 2)); } - } - while (p1.i < p1.length && p2.i < p2.length) { - if (fixZ(p1) || fixZ(p2)) continue; - if (command(p1) == command(p2)) { + return keyPoints; + }); + // 对比两个路径的关键位置,在合适的位置切割合适的路径,使得两个路径的段数一致 + // TODO: 使用插值算法,使对应点更合理 + var alignCurve = cacher(function(path1, path2) { + if (!path1.isCurve) path1 = g.pathToCurve(path1); + if (!path2.isCurve) path2 = g.pathToCurve(path2); + var p1 = pathClone(path1); + var p2 = pathClone(path2); + p1.i = 0; + p2.i = 0; + p1.o = p2; + p2.o = p1; + function command(p, i) { + return p[i || p.i] && p[i || p.i][0]; + } + function param(p, i) { + return p[i || p.i] && p[i || p.i].slice(1); + } + function point(p, i) { + var _param = param(p, i); + return _param && _param.slice(-2); + } + function fixZ(p) { + if (command(p) == "Z") { + p.splice(p.i, 1); + return true; + } + return false; + } + function fixM(p) { + if (command(p) == "M") { + p.o.splice(p.o.i, 0, [ "M" ].concat(point(p.o, p.o.i - 1))); + p.i++; + p.o.i++; + return true; + } + return false; + } + function fill(p) { + var lastPoint; + var i = 1; + while (!lastPoint) { + lastPoint = point(p, p.length - i++); + } + p.o.i = p.i; + while (p.length < p.o.length) { + if (fixZ(p.o)) continue; + if (fixM(p.o)) continue; + p.push([ "C" ].concat(lastPoint).concat(lastPoint).concat(lastPoint)); + p.i++; + p.o.i++; + } + } + while (p1.i < p1.length && p2.i < p2.length) { + if (fixZ(p1) || fixZ(p2)) continue; + if (command(p1) == command(p2)) { + p1.i++; + p2.i++; + continue; + } + if (fixM(p1) || fixM(p2)) continue; p1.i++; p2.i++; - continue; } - if (fixM(p1) || fixM(p2)) continue; - p1.i++; - p2.i++; - } - if (p1.i == p1.length) fill(p1); - if (p2.i == p2.length) fill(p2); - delete p1.i; - delete p1.o; - delete p2.i; - delete p2.o; - return [ p1, p2 ]; - }); - g.alignCurve = alignCurve; - /** + if (p1.i == p1.length) fill(p1); + if (p2.i == p2.length) fill(p2); + delete p1.i; + delete p1.o; + delete p2.i; + delete p2.o; + return [ p1, p2 ]; + }); + g.alignCurve = alignCurve; + /** * 获得两个路径的补间结果 * * @param {string|Array} path1 @@ -4864,24 +5129,24 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * @return {PathSegment} * 补间的结果 */ - g.pathTween = function(path1, path2, t) { - if (t === 0) return path1; - if (t === 1) return path2; - var aligned = alignCurve(path1, path2); - var result = [], seg, i, j; - path1 = aligned[0]; - path2 = aligned[1]; - for (i = 0; i < path1.length; i++) { - result.push(seg = []); - seg.push(path1[i][0]); - for (j = 1; j < path1[i].length; j++) { - seg.push(path1[i][j] + t * (path2[i][j] - path1[i][j])); + g.pathTween = function(path1, path2, t) { + if (t === 0) return path1; + if (t === 1) return path2; + var aligned = alignCurve(path1, path2); + var result = [], seg, i, j; + path1 = aligned[0]; + path2 = aligned[1]; + for (i = 0; i < path1.length; i++) { + result.push(seg = []); + seg.push(path1[i][0]); + for (j = 1; j < path1[i].length; j++) { + seg.push(path1[i][j] + t * (path2[i][j] - path1[i][j])); + } } - } - result.isUniform = result.isCurve = result.isAbsolute = true; - return result; - }; - /** + result.isUniform = result.isCurve = result.isAbsolute = true; + return result; + }; + /** * 变换指定的路径 * * @param {String|Array} path @@ -4893,1097 +5158,1161 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph * @return {Array} * 变换后的路径 */ - g.transformPath = cacher(function(path, matrix) { - var i, ii, j, result, seg, pair; - if (!path.isCurve) { - path = g.pathToCurve(path); - } - result = []; - for (i = 0, ii = path.length; i < ii; i++) { - result.push(seg = [ path[i][0] ]); - for (j = 1; j < path[i].length; j += 2) { - pair = path[i].slice(j, j + 2); - pair = matrix.transformPoint(Point.parse(pair)); - result.push(pair); + g.transformPath = cacher(function(path, matrix) { + var i, ii, j, result, seg, pair; + if (!path.isCurve) { + path = g.pathToCurve(path); + } + result = []; + for (i = 0, ii = path.length; i < ii; i++) { + result.push(seg = [ path[i][0] ]); + for (j = 1; j < path[i].length; j += 2) { + pair = path[i].slice(j, j + 2); + pair = matrix.transformPoint(Point.parse(pair)); + result.push(pair); + } } - } - return result; - }); - // entend - require("core/class").extendClass(Matrix, { - transformPath: function(path) { - return g.transformPath(path, this); - } - }); - return g; -}); -define("graphic/gradientbrush", [ "graphic/svg", "graphic/defbrush", "core/class", "graphic/resource", "graphic/color", "core/utils", "graphic/standardcolor" ], function(require, exports, module) { - var svg = require("graphic/svg"); - var DefBrush = require("graphic/defbrush"); - var Color = require("graphic/color"); - return require("core/class").createClass("GradientBrush", { - base: DefBrush, - constructor: function(gradientNodeType) { - this.callBase(gradientNodeType); - this.stops = []; - }, - addStop: function(offset, color, opacity) { - var gstop = svg.createNode("stop"); - if (!(color instanceof Color)) { - color = Color.parse(color); + return result; + }); + // entend + _p.r(11).extendClass(Matrix, { + transformPath: function(path) { + return g.transformPath(path, this); } - if (opacity === undefined) { - opacity = color.get("a"); + }); + return g; + } +}; + +//src/graphic/gradientbrush.js +_p[36] = { + value: function(require, exports, module) { + var svg = _p.r(68); + var DefBrush = _p.r(32); + var Color = _p.r(28); + return _p.r(11).createClass("GradientBrush", { + base: DefBrush, + constructor: function(gradientNodeType) { + this.callBase(gradientNodeType); + this.stops = []; + }, + addStop: function(offset, color, opacity) { + var gstop = svg.createNode("stop"); + if (!(color instanceof Color)) { + color = Color.parse(color); + } + if (opacity === undefined) { + opacity = color.get("a"); + } + gstop.setAttribute("offset", offset); + gstop.setAttribute("stop-color", color.toRGB()); + if (opacity < 1) { + gstop.setAttribute("stop-opacity", opacity); + } + this.node.appendChild(gstop); + return this; } - gstop.setAttribute("offset", offset); - gstop.setAttribute("stop-color", color.toRGB()); - if (opacity < 1) { - gstop.setAttribute("stop-opacity", opacity); + }); + } +}; + +//src/graphic/group.js +_p[37] = { + value: function(require, exports, module) { + var ShapeContainer = _p.r(62); + return _p.r(11).createClass("Group", { + mixins: [ ShapeContainer ], + base: _p.r(61), + constructor: function Group() { + this.callBase("g"); } - this.node.appendChild(gstop); - return this; - } - }); -}); -define("graphic/group", [ "graphic/shapecontainer", "graphic/container", "core/utils", "core/class", "graphic/shape", "graphic/svg", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box" ], function(require, exports, module) { - var ShapeContainer = require("graphic/shapecontainer"); - return require("core/class").createClass("Group", { - mixins: [ ShapeContainer ], - base: require("graphic/shape"), - constructor: function Group() { - this.callBase("g"); - } - }); -}); -define("graphic/hyperlink", [ "graphic/shapecontainer", "graphic/container", "core/utils", "core/class", "graphic/shape", "graphic/svg", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box" ], function(require, exports, module) { - var ShapeContainer = require("graphic/shapecontainer"); - return require("core/class").createClass("HyperLink", { - mixins: [ ShapeContainer ], - base: require("graphic/shape"), - constructor: function(url) { - this.callBase("a"); - this.setHref(url); - }, - setHref: function(href) { - this.node.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", href); - return this; - }, - getHref: function() { - return this.node.getAttributeNS("xlink:href"); - }, - setTarget: function(target) { - this.node.setAttribute("target", target); - return this; - }, - getTarget: function() { - return this.node.getAttribute("target"); - } - }); -}); -define("graphic/image", [ "core/class", "graphic/shape", "graphic/svg", "core/utils", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box" ], function(require, exports, module) { - return require("core/class").createClass("Image", { - base: require("graphic/shape"), - constructor: function(url, width, height, x, y) { - this.callBase("image"); - this.url = url; - this.width = width || 0; - this.height = height || 0; - this.x = x || 0; - this.y = y || 0; - this.update(); - }, - update: function() { - this.node.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", this.url); - this.node.setAttribute("x", this.x); - this.node.setAttribute("y", this.y); - this.node.setAttribute("width", this.width); - this.node.setAttribute("height", this.height); - return this; - }, - setUrl: function(url) { - this.url = url === "" ? null : url; - return this.update(); - }, - getUrl: function() { - return this.url; - }, - setWidth: function(width) { - this.width = width; - return this.update(); - }, - getWidth: function() { - return this.width; - }, - setHeight: function(height) { - this.height = height; - return this.update(); - }, - getHeight: function() { - return this.height; - }, - setX: function(x) { - this.x = x; - return this.update(); - }, - getX: function() { - return this.x; - }, - setY: function(y) { - this.y = y; - return this.update(); - }, - getY: function() { - return this.y; - } - }); -}); -define("graphic/line", [ "core/class", "graphic/path", "core/utils", "graphic/shape", "graphic/svg", "graphic/geometry" ], function(require, exports, module) { - return require("core/class").createClass("Line", { - base: require("graphic/path"), - constructor: function(x1, y1, x2, y2) { - this.callBase(); - this.point1 = { - x: x1 || 0, - y: y1 || 0 - }; - this.point2 = { - x: x2 || 0, - y: y2 || 0 - }; - this.update(); - }, - setPoint1: function(x, y) { - this.point1.x = x; - this.point1.y = y; - return this.update(); - }, - setPoint2: function(x, y) { - this.point2.x = x; - this.point2.y = y; - return this.update(); - }, - getPoint1: function() { - return { - x: this.point1.x, - y: this.point1.y - }; - }, - getPoint2: function() { - return { - x: this.point2.x, - y: this.point2.y - }; - }, - update: function() { - var drawer = this.getDrawer(); - drawer.clear(); - drawer.moveTo(this.point1.x, this.point1.y); - drawer.lineTo(this.point2.x, this.point2.y); - return this; - } - }); -}); -define("graphic/lineargradientbrush", [ "graphic/svg", "graphic/gradientbrush", "graphic/defbrush", "graphic/color", "core/class" ], function(require, exports, module) { - var className = "LinearGradientBrush"; - var svg = require("graphic/svg"); - var GradientBrush = require("graphic/gradientbrush"); - return require("core/class").createClass(className, { - base: GradientBrush, - constructor: function(builder) { - this.callBase("linearGradient"); - this.setStartPosition(0, 0); - this.setEndPosition(1, 0); - if (typeof builder == "function") { - builder.call(this, this); + }); + } +}; + +//src/graphic/hyperlink.js +_p[38] = { + value: function(require, exports, module) { + var ShapeContainer = _p.r(62); + return _p.r(11).createClass("HyperLink", { + mixins: [ ShapeContainer ], + base: _p.r(61), + constructor: function(url) { + this.callBase("a"); + this.setHref(url); + }, + setHref: function(href) { + this.node.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", href); + return this; + }, + getHref: function() { + return this.node.getAttributeNS("xlink:href"); + }, + setTarget: function(target) { + this.node.setAttribute("target", target); + return this; + }, + getTarget: function() { + return this.node.getAttribute("target"); } - }, - setStartPosition: function(px, py) { - this.node.setAttribute("x1", px); - this.node.setAttribute("y1", py); - return this; - }, - setEndPosition: function(px, py) { - this.node.setAttribute("x2", px); - this.node.setAttribute("y2", py); - return this; - }, - getStartPosition: function() { - return { - x: +this.node.getAttribute("x1"), - y: +this.node.getAttribute("y1") - }; - }, - getEndPosition: function() { - return { - x: +this.node.getAttribute("x2"), - y: +this.node.getAttribute("y2") - }; - } - }); -}); -define("graphic/marker", [ "graphic/point", "core/class", "graphic/resource", "graphic/svg", "graphic/shapecontainer", "graphic/container", "core/utils", "graphic/shape", "graphic/viewbox", "graphic/path", "graphic/geometry" ], function(require, exports, module) { - var Point = require("graphic/point"); - var Marker = require("core/class").createClass("Marker", { - base: require("graphic/resource"), - mixins: [ require("graphic/shapecontainer"), require("graphic/viewbox") ], - constructor: function() { - this.callBase("marker"); - this.setOrient("auto"); - }, - setRef: function(x, y) { - if (arguments.length === 1) { - y = x.y; - x = x.x; + }); + } +}; + +//src/graphic/image.js +_p[39] = { + value: function(require, exports, module) { + return _p.r(11).createClass("Image", { + base: _p.r(61), + constructor: function(url, width, height, x, y) { + this.callBase("image"); + this.url = url; + this.width = width || 0; + this.height = height || 0; + this.x = x || 0; + this.y = y || 0; + this.update(); + }, + update: function() { + this.node.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", this.url); + this.node.setAttribute("x", this.x); + this.node.setAttribute("y", this.y); + this.node.setAttribute("width", this.width); + this.node.setAttribute("height", this.height); + return this; + }, + setUrl: function(url) { + this.url = url === "" ? null : url; + return this.update(); + }, + getUrl: function() { + return this.url; + }, + setWidth: function(width) { + this.width = width; + return this.update(); + }, + getWidth: function() { + return this.width; + }, + setHeight: function(height) { + this.height = height; + return this.update(); + }, + getHeight: function() { + return this.height; + }, + setX: function(x) { + this.x = x; + return this.update(); + }, + getX: function() { + return this.x; + }, + setY: function(y) { + this.y = y; + return this.update(); + }, + getY: function() { + return this.y; } - this.node.setAttribute("refX", x); - this.node.setAttribute("refY", y); - return this; - }, - getRef: function() { - return new Point(+this.node.getAttribute("refX"), +this.node.getAttribute("refY")); - }, - setWidth: function(width) { - this.node.setAttribute("markerWidth", this.width = width); - return this; - }, - setOrient: function(orient) { - this.node.setAttribute("orient", this.orient = orient); - return this; - }, - getOrient: function() { - return this.orient; - }, - getWidth: function() { - return +this.width; - }, - setHeight: function(height) { - this.node.setAttribute("markerHeight", this.height = height); - return this; - }, - getHeight: function() { - return +this.height; - } - }); - var Path = require("graphic/path"); - require("core/class").extendClass(Path, { - setMarker: function(marker, pos) { - pos = pos || "end"; - if (!marker) { - this.node.removeAttribute("marker-" + pos); - } else { - this.node.setAttribute("marker-" + pos, marker.toString()); + }); + } +}; + +//src/graphic/line.js +_p[40] = { + value: function(require, exports, module) { + return _p.r(11).createClass("Line", { + base: _p.r(47), + constructor: function(x1, y1, x2, y2) { + this.callBase(); + this.point1 = { + x: x1 || 0, + y: y1 || 0 + }; + this.point2 = { + x: x2 || 0, + y: y2 || 0 + }; + this.update(); + }, + setPoint1: function(x, y) { + this.point1.x = x; + this.point1.y = y; + return this.update(); + }, + setPoint2: function(x, y) { + this.point2.x = x; + this.point2.y = y; + return this.update(); + }, + getPoint1: function() { + return { + x: this.point1.x, + y: this.point1.y + }; + }, + getPoint2: function() { + return { + x: this.point2.x, + y: this.point2.y + }; + }, + update: function() { + var drawer = this.getDrawer(); + drawer.clear(); + drawer.moveTo(this.point1.x, this.point1.y); + drawer.lineTo(this.point2.x, this.point2.y); + return this; } - return this; - } - }); - return Marker; -}); -/** - * 蒙板 - */ -define("graphic/mask", [ "core/class", "graphic/shape", "graphic/svg", "core/utils", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box", "graphic/shapecontainer", "graphic/container" ], function(require, exports, module) { - var Class = require("core/class"); - var Shape = require("graphic/shape"); - var Mask = Class.createClass("Mask", { - base: Shape, - mixins: [ require("graphic/shapecontainer") ], - constructor: function() { - this.callBase("mask"); - }, - mask: function(shape) { - shape.getNode().setAttribute("mask", "url(#" + this.getId() + ")"); - return this; - } - }); - Class.extendClass(Shape, { - maskWith: function(mask) { - mask.mask(this); - return this; - } - }); - return Mask; -}); -define("graphic/matrix", [ "core/utils", "graphic/box", "core/class", "graphic/point" ], function(require, exports, module) { - var utils = require("core/utils"); - var Box = require("graphic/box"); - var mPattern = /matrix\((.+)\)/i; - var Point = require("graphic/point"); - // 注意,合并的结果是先执行m2,再执行m1的结果 - function mergeMatrixData(m2, m1) { - return { - a: m1.a * m2.a + m1.c * m2.b, - b: m1.b * m2.a + m1.d * m2.b, - c: m1.a * m2.c + m1.c * m2.d, - d: m1.b * m2.c + m1.d * m2.d, - e: m1.a * m2.e + m1.c * m2.f + m1.e, - f: m1.b * m2.e + m1.d * m2.f + m1.f - }; + }); } - function d2r(deg) { - return deg * Math.PI / 180; +}; + +//src/graphic/lineargradientbrush.js +_p[41] = { + value: function(require, exports, module) { + var className = "LinearGradientBrush"; + var svg = _p.r(68); + var GradientBrush = _p.r(36); + return _p.r(11).createClass(className, { + base: GradientBrush, + constructor: function(builder) { + this.callBase("linearGradient"); + this.setStartPosition(0, 0); + this.setEndPosition(1, 0); + if (typeof builder == "function") { + builder.call(this, this); + } + }, + setStartPosition: function(px, py) { + this.node.setAttribute("x1", px); + this.node.setAttribute("y1", py); + return this; + }, + setEndPosition: function(px, py) { + this.node.setAttribute("x2", px); + this.node.setAttribute("y2", py); + return this; + }, + getStartPosition: function() { + return { + x: +this.node.getAttribute("x1"), + y: +this.node.getAttribute("y1") + }; + }, + getEndPosition: function() { + return { + x: +this.node.getAttribute("x2"), + y: +this.node.getAttribute("y2") + }; + } + }); } - var Matrix = require("core/class").createClass("Matrix", { - constructor: function() { - if (arguments.length) { - this.setMatrix.apply(this, arguments); - } else { - this.setMatrix(1, 0, 0, 1, 0, 0); +}; + +//src/graphic/marker.js +_p[42] = { + value: function(require, exports, module) { + var Point = _p.r(51); + var Marker = _p.r(11).createClass("Marker", { + base: _p.r(59), + mixins: [ _p.r(62), _p.r(76) ], + constructor: function() { + this.callBase("marker"); + this.setOrient("auto"); + }, + setRef: function(x, y) { + if (arguments.length === 1) { + y = x.y; + x = x.x; + } + this.node.setAttribute("refX", x); + this.node.setAttribute("refY", y); + return this; + }, + getRef: function() { + return new Point(+this.node.getAttribute("refX"), +this.node.getAttribute("refY")); + }, + setWidth: function(width) { + this.node.setAttribute("markerWidth", this.width = width); + return this; + }, + setOrient: function(orient) { + this.node.setAttribute("orient", this.orient = orient); + return this; + }, + getOrient: function() { + return this.orient; + }, + getWidth: function() { + return +this.width; + }, + setHeight: function(height) { + this.node.setAttribute("markerHeight", this.height = height); + return this; + }, + getHeight: function() { + return +this.height; } - }, - translate: function(x, y) { - this.m = mergeMatrixData(this.m, { - a: 1, - c: 0, - e: x, - b: 0, - d: 1, - f: y - }); - return this; - }, - rotate: function(deg) { - var rad = d2r(deg); - var sin = Math.sin(rad), cos = Math.cos(rad); - this.m = mergeMatrixData(this.m, { - a: cos, - c: -sin, - e: 0, - b: sin, - d: cos, - f: 0 - }); - return this; - }, - scale: function(sx, sy) { - if (sy === undefined) { - sy = sx; + }); + var Path = _p.r(47); + _p.r(11).extendClass(Path, { + setMarker: function(marker, pos) { + pos = pos || "end"; + if (!marker) { + this.node.removeAttribute("marker-" + pos); + } else { + this.node.setAttribute("marker-" + pos, marker.toString()); + } + return this; } - this.m = mergeMatrixData(this.m, { - a: sx, - c: 0, - e: 0, - b: 0, - d: sy, - f: 0 - }); - return this; - }, - skew: function(degX, degY) { - if (degY === undefined) { - degY = degX; + }); + return Marker; + } +}; + +//src/graphic/mask.js +/** + * 蒙板 + */ +_p[43] = { + value: function(require, exports, module) { + var Class = _p.r(11); + var Shape = _p.r(61); + var Mask = Class.createClass("Mask", { + base: Shape, + mixins: [ _p.r(62) ], + constructor: function() { + this.callBase("mask"); + }, + mask: function(shape) { + shape.getNode().setAttribute("mask", "url(#" + this.getId() + ")"); + return this; } - var tx = Math.tan(d2r(degX)), ty = Math.tan(d2r(degY)); - this.m = mergeMatrixData(this.m, { - a: 1, - c: tx, - e: 0, - b: ty, - d: 1, - f: 0 - }); - return this; - }, - /** + }); + Class.extendClass(Shape, { + maskWith: function(mask) { + mask.mask(this); + return this; + } + }); + return Mask; + } +}; + +//src/graphic/matrix.js +_p[44] = { + value: function(require, exports, module) { + var utils = _p.r(12); + var Box = _p.r(25); + var mPattern = /matrix\((.+)\)/i; + var Point = _p.r(51); + // 注意,合并的结果是先执行m2,再执行m1的结果 + function mergeMatrixData(m2, m1) { + return { + a: m1.a * m2.a + m1.c * m2.b, + b: m1.b * m2.a + m1.d * m2.b, + c: m1.a * m2.c + m1.c * m2.d, + d: m1.b * m2.c + m1.d * m2.d, + e: m1.a * m2.e + m1.c * m2.f + m1.e, + f: m1.b * m2.e + m1.d * m2.f + m1.f + }; + } + function d2r(deg) { + return deg * Math.PI / 180; + } + var Matrix = _p.r(11).createClass("Matrix", { + constructor: function() { + if (arguments.length) { + this.setMatrix.apply(this, arguments); + } else { + this.setMatrix(1, 0, 0, 1, 0, 0); + } + }, + translate: function(x, y) { + this.m = mergeMatrixData(this.m, { + a: 1, + c: 0, + e: x, + b: 0, + d: 1, + f: y + }); + return this; + }, + rotate: function(deg) { + var rad = d2r(deg); + var sin = Math.sin(rad), cos = Math.cos(rad); + this.m = mergeMatrixData(this.m, { + a: cos, + c: -sin, + e: 0, + b: sin, + d: cos, + f: 0 + }); + return this; + }, + scale: function(sx, sy) { + if (sy === undefined) { + sy = sx; + } + this.m = mergeMatrixData(this.m, { + a: sx, + c: 0, + e: 0, + b: 0, + d: sy, + f: 0 + }); + return this; + }, + skew: function(degX, degY) { + if (degY === undefined) { + degY = degX; + } + var tx = Math.tan(d2r(degX)), ty = Math.tan(d2r(degY)); + this.m = mergeMatrixData(this.m, { + a: 1, + c: tx, + e: 0, + b: ty, + d: 1, + f: 0 + }); + return this; + }, + /** * 获得反转矩阵 * * 这是我解方程算出来的 */ - inverse: function() { - var m = this.m, a = m.a, b = m.b, c = m.c, d = m.d, e = m.e, f = m.f, k, aa, bb, cc, dd, ee, ff; - k = a * d - b * c; - aa = d / k; - bb = -b / k; - cc = -c / k; - dd = a / k; - ee = (c * f - e * d) / k; - ff = (b * e - a * f) / k; - return new Matrix(aa, bb, cc, dd, ee, ff); - }, - setMatrix: function(a, b, c, d, e, f) { - if (arguments.length === 1) { - this.m = utils.clone(arguments[0]); - } else { - this.m = { - a: a, - b: b, - c: c, - d: d, - e: e, - f: f + inverse: function() { + var m = this.m, a = m.a, b = m.b, c = m.c, d = m.d, e = m.e, f = m.f, k, aa, bb, cc, dd, ee, ff; + k = a * d - b * c; + aa = d / k; + bb = -b / k; + cc = -c / k; + dd = a / k; + ee = (c * f - e * d) / k; + ff = (b * e - a * f) / k; + return new Matrix(aa, bb, cc, dd, ee, ff); + }, + setMatrix: function(a, b, c, d, e, f) { + if (arguments.length === 1) { + this.m = utils.clone(arguments[0]); + } else { + this.m = { + a: a, + b: b, + c: c, + d: d, + e: e, + f: f + }; + } + return this; + }, + getMatrix: function() { + return utils.clone(this.m); + }, + getTranslate: function() { + var m = this.m; + return { + x: m.e / m.a, + y: m.f / m.d }; + }, + mergeMatrix: function(matrix) { + return new Matrix(mergeMatrixData(this.m, matrix.m)); + }, + merge: function(matrix) { + return this.mergeMatrix(matrix); + }, + toString: function() { + return this.valueOf().join(" "); + }, + valueOf: function() { + var m = this.m; + return [ m.a, m.b, m.c, m.d, m.e, m.f ]; + }, + equals: function(matrix) { + var m1 = this.m, m2 = matrix.m; + return m1.a == m2.a && m1.b == m2.b && m1.c == m2.c && m1.d == m2.d && m1.e == m2.e && m1.f == m2.f; + }, + transformPoint: function() { + return Matrix.transformPoint.apply(null, [].slice.call(arguments).concat([ this.m ])); + }, + transformBox: function(box) { + return Matrix.transformBox(box, this.m); } - return this; - }, - getMatrix: function() { - return utils.clone(this.m); - }, - getTranslate: function() { - var m = this.m; - return { - x: m.e / m.a, - y: m.f / m.d - }; - }, - mergeMatrix: function(matrix) { - return new Matrix(mergeMatrixData(this.m, matrix.m)); - }, - merge: function(matrix) { - return this.mergeMatrix(matrix); - }, - toString: function() { - return this.valueOf().join(" "); - }, - valueOf: function() { - var m = this.m; - return [ m.a, m.b, m.c, m.d, m.e, m.f ]; - }, - equals: function(matrix) { - var m1 = this.m, m2 = matrix.m; - return m1.a == m2.a && m1.b == m2.b && m1.c == m2.c && m1.d == m2.d && m1.e == m2.e && m1.f == m2.f; - }, - transformPoint: function() { - return Matrix.transformPoint.apply(null, [].slice.call(arguments).concat([ this.m ])); - }, - transformBox: function(box) { - return Matrix.transformBox(box, this.m); - } - }); - Matrix.parse = function(str) { - var match; - var f = parseFloat; - if (str instanceof Array) { - return new Matrix({ - a: str[0], - b: str[1], - c: str[2], - d: str[3], - e: str[4], - f: str[5] + }); + Matrix.parse = function(str) { + var match; + var f = parseFloat; + if (str instanceof Array) { + return new Matrix({ + a: str[0], + b: str[1], + c: str[2], + d: str[3], + e: str[4], + f: str[5] + }); + } + if (match = mPattern.exec(str)) { + var values = match[1].split(","); + if (values.length != 6) { + values = match[1].split(" "); + } + return new Matrix({ + a: f(values[0]), + b: f(values[1]), + c: f(values[2]), + d: f(values[3]), + e: f(values[4]), + f: f(values[5]) + }); + } + return new Matrix(); + }; + Matrix.transformPoint = function(x, y, m) { + if (arguments.length === 2) { + m = y; + y = x.y; + x = x.x; + } + return new Point(m.a * x + m.c * y + m.e, m.b * x + m.d * y + m.f); + }; + Matrix.transformBox = function(box, matrix) { + var xMin = Number.MAX_VALUE, xMax = -Number.MAX_VALUE, yMin = Number.MAX_VALUE, yMax = -Number.MAX_VALUE; + var bps = [ [ box.x, box.y ], [ box.x + box.width, box.y ], [ box.x, box.y + box.height ], [ box.x + box.width, box.y + box.height ] ]; + var bp, rp, rps = []; + while (bp = bps.pop()) { + rp = Matrix.transformPoint(bp[0], bp[1], matrix); + rps.push(rp); + xMin = Math.min(xMin, rp.x); + xMax = Math.max(xMax, rp.x); + yMin = Math.min(yMin, rp.y); + yMax = Math.max(yMax, rp.y); + } + box = new Box({ + x: xMin, + y: yMin, + width: xMax - xMin, + height: yMax - yMin }); - } - if (match = mPattern.exec(str)) { - var values = match[1].split(","); - if (values.length != 6) { - values = match[1].split(" "); - } - return new Matrix({ - a: f(values[0]), - b: f(values[1]), - c: f(values[2]), - d: f(values[3]), - e: f(values[4]), - f: f(values[5]) + utils.extend(box, { + closurePoints: rps }); - } - return new Matrix(); - }; - Matrix.transformPoint = function(x, y, m) { - if (arguments.length === 2) { - m = y; - y = x.y; - x = x.x; - } - return new Point(m.a * x + m.c * y + m.e, m.b * x + m.d * y + m.f); - }; - Matrix.transformBox = function(box, matrix) { - var xMin = Number.MAX_VALUE, xMax = -Number.MAX_VALUE, yMin = Number.MAX_VALUE, yMax = -Number.MAX_VALUE; - var bps = [ [ box.x, box.y ], [ box.x + box.width, box.y ], [ box.x, box.y + box.height ], [ box.x + box.width, box.y + box.height ] ]; - var bp, rp, rps = []; - while (bp = bps.pop()) { - rp = Matrix.transformPoint(bp[0], bp[1], matrix); - rps.push(rp); - xMin = Math.min(xMin, rp.x); - xMax = Math.max(xMax, rp.x); - yMin = Math.min(yMin, rp.y); - yMax = Math.max(yMax, rp.y); - } - box = new Box({ - x: xMin, - y: yMin, - width: xMax - xMin, - height: yMax - yMin - }); - utils.extend(box, { - closurePoints: rps - }); - return box; - }; - // 获得从 node 到 refer 的变换矩阵 - Matrix.getCTM = function(target, refer) { - var ctm = { - a: 1, - b: 0, - c: 0, - d: 1, - e: 0, - f: 0 + return box; }; - var node = target.shapeNode || target.node; - refer = refer || "parent"; - // 根据参照坐标系选区的不一样,返回不同的结果 - switch (refer) { - case "screen": - // 以浏览器屏幕为参照坐标系 - ctm = node.getScreenCTM(); - break; + // 获得从 node 到 refer 的变换矩阵 + Matrix.getCTM = function(target, refer) { + var ctm = { + a: 1, + b: 0, + c: 0, + d: 1, + e: 0, + f: 0 + }; + var node = target.shapeNode || target.node; + refer = refer || "parent"; + // 根据参照坐标系选区的不一样,返回不同的结果 + switch (refer) { + case "screen": + // 以浏览器屏幕为参照坐标系 + ctm = node.getScreenCTM(); + break; - case "doc": - case "paper": - // 以文档(Paper)为参照坐标系 - ctm = node.getCTM(); - break; + case "doc": + case "paper": + // 以文档(Paper)为参照坐标系 + ctm = node.getCTM(); + break; - case "view": - case "top": - // 以顶层绘图容器(视野)为参照坐标系 - if (target.getPaper()) { - ctm = node.getTransformToElement(target.getPaper().shapeNode); - } - break; + case "view": + case "top": + // 以顶层绘图容器(视野)为参照坐标系 + if (target.getPaper()) { + ctm = node.getTransformToElement(target.getPaper().shapeNode); + } + break; - case "parent": - // 以父容器为参照坐标系 - if (target.node.parentNode) { - ctm = node.getTransformToElement(target.node.parentNode); - } - break; + case "parent": + // 以父容器为参照坐标系 + if (target.node.parentNode) { + ctm = node.getTransformToElement(target.node.parentNode); + } + break; - default: - // 其他情况,指定参照物 - if (refer.node) { - ctm = node.getTransformToElement(refer.shapeNode || refer.node); + default: + // 其他情况,指定参照物 + if (refer.node) { + ctm = node.getTransformToElement(refer.shapeNode || refer.node); + } } - } - return ctm ? new Matrix(ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f) : new Matrix(); - }; - return Matrix; -}); + return ctm ? new Matrix(ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f) : new Matrix(); + }; + return Matrix; + } +}; + +//src/graphic/palette.js /** * 调色板 */ -define("graphic/palette", [ "graphic/standardcolor", "graphic/color", "core/utils", "core/class" ], function(require, exports, module) { - //标准color - var StandardColor = require("graphic/standardcolor"), Color = require("graphic/color"), Utils = require("core/utils"); - var Palette = require("core/class").createClass("Palette", { - constructor: function() { - this.color = {}; - }, - /* +_p[45] = { + value: function(require, exports, module) { + //标准color + var StandardColor = _p.r(65), Color = _p.r(28), Utils = _p.r(12); + var Palette = _p.r(11).createClass("Palette", { + constructor: function() { + this.color = {}; + }, + /* * 获取颜色名称所对应的颜色值的Color对象 * @param name 需要获取的颜色名称 * @return 对应颜色名称的color对象, 如果未找到对应的名称, 则返回null */ - get: function(name) { - var colorValue = this.color[name] || StandardColor.EXTEND_STANDARD[name] || StandardColor.COLOR_STANDARD[name] || ""; - if (colorValue) { - return new Color(colorValue); - } - return null; - }, - /* + get: function(name) { + var colorValue = this.color[name] || StandardColor.EXTEND_STANDARD[name] || StandardColor.COLOR_STANDARD[name] || ""; + if (colorValue) { + return new Color(colorValue); + } + return null; + }, + /* * 获取给定名称的颜色的hex值表示 * @param name 需要获取的颜色名称 * @return 如果找到对应的名称, 则返回该名称所对应的hex格式的值, 否则, 返回一个空字符串 */ - getColorValue: function(name) { - return this.color[name] || StandardColor.EXTEND_STANDARD[name] || StandardColor.COLOR_STANDARD[name] || ""; - }, - /* + getColorValue: function(name) { + return this.color[name] || StandardColor.EXTEND_STANDARD[name] || StandardColor.COLOR_STANDARD[name] || ""; + }, + /* * 向调色板实例添加自己独有的颜色名称,对已存在的颜色名称, 将会覆盖掉 * @param name 新添加的颜色名称 * @param value 新添加的颜色名称所对应的值, 可以是一个合法的颜色字符串或者是一个color对象 * @return 新添加的颜色的值 */ - add: function(name, value) { - if (typeof value === "string") { - this.color[name] = new Color(value).toRGBA(); - } else { - this.color[name] = value.toRGBA(); - } - return value; - }, - /* + add: function(name, value) { + if (typeof value === "string") { + this.color[name] = new Color(value).toRGBA(); + } else { + this.color[name] = value.toRGBA(); + } + return value; + }, + /* * 删除调色板实例上用户自己添加的颜色, 该方法不能删除内置的颜色 * @param name 需要删除的颜色名称 * @return 删除是否成功的bool值 */ - remove: function(name) { - if (this.color.hasOwnProperty(name)) { - delete this.color[name]; - return true; - } - return false; - } - }); - Utils.extend(Palette, { - getColor: function(name) { - var colorValue = StandardColor.EXTEND_STANDARD[name] || StandardColor.COLOR_STANDARD[name]; - if (colorValue) { - return new Color(colorValue); + remove: function(name) { + if (this.color.hasOwnProperty(name)) { + delete this.color[name]; + return true; + } + return false; } - return null; - }, - /* + }); + Utils.extend(Palette, { + getColor: function(name) { + var colorValue = StandardColor.EXTEND_STANDARD[name] || StandardColor.COLOR_STANDARD[name]; + if (colorValue) { + return new Color(colorValue); + } + return null; + }, + /* * 通过给定的名字获取标准的颜色值表示, 返回的值以hex的方式提供 * @param name 需要获取的标准颜色名称 * @return 名字所对应的颜色值的hex表示, 如果未找到对应名称的值, 则返回一个空字符串 */ - getColorValue: function(name) { - return StandardColor.EXTEND_STANDARD[name] || StandardColor.COLOR_STANDARD[name] || ""; - }, - /* + getColorValue: function(name) { + return StandardColor.EXTEND_STANDARD[name] || StandardColor.COLOR_STANDARD[name] || ""; + }, + /* * 向调色板添加颜色名称,新添加的颜色对所有的调色板对象都可见 * 对已存在的颜色名称, 将会覆盖掉 * @param name 新添加的颜色名称 * @param value 新添加的颜色名称所对于的值, 应该是一个hex格式的颜色字符串, 如: ”#ff0000“ * @return 新添加的颜色的值 */ - addColor: function(name, value) { - if (typeof value === "string") { - StandardColor.EXTEND_STANDARD[name] = new Color(value).toRGBA(); - } else { - StandardColor.EXTEND_STANDARD[name] = value.toRGBA(); - } - return value; - }, - /* + addColor: function(name, value) { + if (typeof value === "string") { + StandardColor.EXTEND_STANDARD[name] = new Color(value).toRGBA(); + } else { + StandardColor.EXTEND_STANDARD[name] = value.toRGBA(); + } + return value; + }, + /* * 删除用户自己添加的颜色, 该方法不能删除内置的颜色, 该方法不会影响调色板实例自由的颜色 * @param name 需要删除的颜色名称 * @return 删除是否成功的bool值 */ - removeColor: function(name) { - if (StandardColor.EXTEND_STANDARD.hasOwnProperty(name)) { - delete StandardColor.EXTEND_STANDARD[name]; - return true; - } - return false; - } - }); - return Palette; -}); -define("graphic/paper", [ "core/class", "core/utils", "graphic/svg", "graphic/container", "graphic/shapecontainer", "graphic/shape", "graphic/viewbox", "graphic/eventhandler", "graphic/shapeevent", "graphic/styled", "graphic/matrix", "graphic/box", "graphic/point", "graphic/data", "graphic/pen" ], function(require, exports, module) { - var Class = require("core/class"); - var utils = require("core/utils"); - var svg = require("graphic/svg"); - var Container = require("graphic/container"); - var ShapeContainer = require("graphic/shapecontainer"); - var ViewBox = require("graphic/viewbox"); - var EventHandler = require("graphic/eventhandler"); - var Styled = require("graphic/styled"); - var Matrix = require("graphic/matrix"); - var Paper = Class.createClass("Paper", { - mixins: [ ShapeContainer, EventHandler, Styled, ViewBox ], - constructor: function(container) { - this.callBase(); - this.node = this.createSVGNode(); - this.node.paper = this; - this.node.appendChild(this.resourceNode = svg.createNode("defs")); - this.node.appendChild(this.shapeNode = svg.createNode("g")); - this.resources = new Container(); - this.setWidth("100%").setHeight("100%"); - if (container) { - this.renderTo(container); - } - this.callMixin(); - }, - renderTo: function(container) { - if (utils.isString(container)) { - container = document.getElementById(container); + removeColor: function(name) { + if (StandardColor.EXTEND_STANDARD.hasOwnProperty(name)) { + delete StandardColor.EXTEND_STANDARD[name]; + return true; + } + return false; } - this.container = container; - container.appendChild(this.node); - }, - createSVGNode: function() { - var node = svg.createNode("svg"); - node.setAttribute("xmlns", "http://www.w3.org/2000/svg"); - node.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); - return node; - }, - getNode: function() { - return this.node; - }, - getContainer: function() { - return this.container; - }, - getWidth: function() { - return this.node.clientWidth; - }, - setWidth: function(width) { - this.node.setAttribute("width", width); - return this; - }, - getHeight: function() { - return this.node.clientHeight; - }, - setHeight: function(height) { - this.node.setAttribute("height", height); - return this; - }, - setViewPort: function(cx, cy, zoom) { - var viewport, box; - if (arguments.length == 1) { - viewport = arguments[0]; - cx = viewport.center.x; - cy = viewport.center.y; - zoom = viewport.zoom; - } - zoom = zoom || 1; - box = this.getViewBox(); - var matrix = new Matrix(); - var dx = box.x + box.width / 2 - cx, dy = box.y + box.height / 2 - cy; - matrix.translate(-cx, -cy); - matrix.scale(zoom); - matrix.translate(cx, cy); - matrix.translate(dx, dy); - this.shapeNode.setAttribute("transform", "matrix(" + matrix + ")"); - this.viewport = { - center: { - x: cx, - y: cy - }, - offset: { - x: dx, - y: dy - }, - zoom: zoom - }; - return this; - }, - getViewPort: function() { - if (!this.viewport) { - var box = this.getViewBox(); - return { - zoom: 1, + }); + return Palette; + } +}; + +//src/graphic/paper.js +_p[46] = { + value: function(require, exports, module) { + var Class = _p.r(11); + var utils = _p.r(12); + var svg = _p.r(68); + var Container = _p.r(29); + var ShapeContainer = _p.r(62); + var ViewBox = _p.r(76); + var EventHandler = _p.r(34); + var Styled = _p.r(67); + var Matrix = _p.r(44); + var Paper = Class.createClass("Paper", { + mixins: [ ShapeContainer, EventHandler, Styled, ViewBox ], + constructor: function(container) { + this.callBase(); + this.node = this.createSVGNode(); + this.node.paper = this; + this.node.appendChild(this.resourceNode = svg.createNode("defs")); + this.node.appendChild(this.shapeNode = svg.createNode("g")); + this.resources = new Container(); + this.setWidth("100%").setHeight("100%"); + if (container) { + this.renderTo(container); + } + this.callMixin(); + }, + renderTo: function(container) { + if (utils.isString(container)) { + container = document.getElementById(container); + } + this.container = container; + container.appendChild(this.node); + }, + createSVGNode: function() { + var node = svg.createNode("svg"); + node.setAttribute("xmlns", "http://www.w3.org/2000/svg"); + node.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); + return node; + }, + getNode: function() { + return this.node; + }, + getContainer: function() { + return this.container; + }, + getWidth: function() { + return this.node.clientWidth; + }, + setWidth: function(width) { + this.node.setAttribute("width", width); + return this; + }, + getHeight: function() { + return this.node.clientHeight; + }, + setHeight: function(height) { + this.node.setAttribute("height", height); + return this; + }, + setViewPort: function(cx, cy, zoom) { + var viewport, box; + if (arguments.length == 1) { + viewport = arguments[0]; + cx = viewport.center.x; + cy = viewport.center.y; + zoom = viewport.zoom; + } + zoom = zoom || 1; + box = this.getViewBox(); + var matrix = new Matrix(); + var dx = box.x + box.width / 2 - cx, dy = box.y + box.height / 2 - cy; + matrix.translate(-cx, -cy); + matrix.scale(zoom); + matrix.translate(cx, cy); + matrix.translate(dx, dy); + this.shapeNode.setAttribute("transform", "matrix(" + matrix + ")"); + this.viewport = { center: { - x: box.x + box.width / 2, - y: box.y + box.height / 2 + x: cx, + y: cy }, offset: { - x: 0, - y: 0 - } + x: dx, + y: dy + }, + zoom: zoom }; + return this; + }, + getViewPort: function() { + if (!this.viewport) { + var box = this.getViewBox(); + return { + zoom: 1, + center: { + x: box.x + box.width / 2, + y: box.y + box.height / 2 + }, + offset: { + x: 0, + y: 0 + } + }; + } + return this.viewport; + }, + getViewPortTransform: function() { + var m = this.shapeNode.getCTM(); + return new Matrix(m.a, m.b, m.c, m.d, m.e, m.f); + }, + getTransform: function() { + return this.getViewPortTransform().reverse(); + }, + addResource: function(resource) { + this.resources.appendItem(resource); + if (resource.node) { + this.resourceNode.appendChild(resource.node); + } + return this; + }, + removeResource: function(resource) { + if (resource.remove) { + resource.remove(); + } + if (resource.node) { + this.resourceNode.removeChild(resource.node); + } + return this; + }, + getPaper: function() { + return this; } - return this.viewport; - }, - getViewPortTransform: function() { - var m = this.shapeNode.getCTM(); - return new Matrix(m.a, m.b, m.c, m.d, m.e, m.f); - }, - getTransform: function() { - return this.getViewPortTransform().reverse(); - }, - addResource: function(resource) { - this.resources.appendItem(resource); - if (resource.node) { - this.resourceNode.appendChild(resource.node); - } - return this; - }, - removeResource: function(resource) { - if (resource.remove) { - resource.remove(); - } - if (resource.node) { - this.resourceNode.removeChild(resource.node); - } - return this; - }, - getPaper: function() { - return this; - } - }); - var Shape = require("graphic/shape"); - Class.extendClass(Shape, { - getPaper: function() { - var parent = this.container; - while (parent && parent instanceof Paper === false) { - parent = parent.container; - } - return parent; - }, - isAttached: function() { - return !!this.getPaper(); - }, - whenPaperReady: function(fn) { - var me = this; - function check() { - var paper = me.getPaper(); - if (paper && fn) { - fn.call(me, paper); - } - return paper; - } - if (!check()) { - this.on("add treeadd", function listen() { - if (check()) { - me.off("add", listen); - me.off("treeadd", listen); + }); + var Shape = _p.r(61); + Class.extendClass(Shape, { + getPaper: function() { + var parent = this.container; + while (parent && parent instanceof Paper === false) { + parent = parent.container; + } + return parent; + }, + isAttached: function() { + return !!this.getPaper(); + }, + whenPaperReady: function(fn) { + var me = this; + function check() { + var paper = me.getPaper(); + if (paper && fn) { + fn.call(me, paper); } - }); - } - return this; - } - }); - return Paper; -}); -define("graphic/path", [ "core/utils", "core/class", "graphic/shape", "graphic/svg", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box", "graphic/geometry", "graphic/point", "graphic/vector" ], function(require, exports, module) { - var Utils = require("core/utils"); - var createClass = require("core/class").createClass; - var Shape = require("graphic/shape"); - var svg = require("graphic/svg"); - var g = require("graphic/geometry"); - var slice = Array.prototype.slice, flatten = Utils.flatten; - var PathDrawer = createClass("PathDrawer", { - constructor: function(path) { - this.segment = []; - this.path = path; - this.__clear = false; - }, - getPath: function() { - return this.path; - }, - redraw: function() { - this._transation = this._transation || []; - return this.clear(); - }, - done: function() { - var transation = this._transation; - this._transation = null; - this.push(transation); - return this; - }, - clear: function() { - if (this._transation) { - this._transation = []; - } else { - this.path.setPathData("M 0 0"); - } - this._clear = true; - return this; - }, - push: function() { - var segment = slice.call(arguments); - var originData; - if (this._transation) { - this._transation.push(segment); + return paper; + } + if (!check()) { + this.on("add treeadd", function listen() { + if (check()) { + me.off("add", listen); + me.off("treeadd", listen); + } + }); + } return this; } - if (this._clear) { - originData = ""; - this._clear = false; - } else { - originData = this.path.getPathData(); + }); + return Paper; + } +}; + +//src/graphic/path.js +_p[47] = { + value: function(require, exports, module) { + var Utils = _p.r(12); + var createClass = _p.r(11).createClass; + var Shape = _p.r(61); + var svg = _p.r(68); + var g = _p.r(35); + var slice = Array.prototype.slice, flatten = Utils.flatten; + var PathDrawer = createClass("PathDrawer", { + constructor: function(path) { + this.segment = []; + this.path = path; + this.__clear = false; + }, + getPath: function() { + return this.path; + }, + redraw: function() { + this._transation = this._transation || []; + return this.clear(); + }, + done: function() { + var transation = this._transation; + this._transation = null; + this.push(transation); + return this; + }, + clear: function() { + if (this._transation) { + this._transation = []; + } else { + this.path.setPathData("M 0 0"); + } + this._clear = true; + return this; + }, + push: function() { + var segment = slice.call(arguments); + var originData; + if (this._transation) { + this._transation.push(segment); + return this; + } + if (this._clear) { + originData = ""; + this._clear = false; + } else { + originData = this.path.getPathData(); + } + originData = originData || ""; + this.path.setPathData(originData + g.pathToString(segment)); + return this; + }, + moveTo: function(x, y) { + return this.push("M", slice.call(arguments)); + }, + moveBy: function(dx, dy) { + return this.push("m", slice.call(arguments)); + }, + lineTo: function(x, y) { + return this.push("L", slice.call(arguments)); + }, + lineBy: function(dx, dy) { + return this.push("l", slice.call(arguments)); + }, + arcTo: function(rx, ry, xr, laf, sf, x, y) { + return this.push("A", slice.call(arguments)); + }, + arcBy: function(rx, ry, xr, laf, sf, dx, dy) { + return this.push("a", arguments); + }, + carcTo: function(r, laf, sf, x, y) { + return this.push("A", [ r, r, 0 ].concat(slice.call(arguments, 1))); + }, + carcBy: function(r, laf, sf, dx, dy) { + return this.push("a", [ r, r, 0 ].concat(slice.call(arguments, 1))); + }, + bezierTo: function(x1, y1, x2, y2, x, y) { + return this.push("C", slice.call(arguments)); + }, + bezierBy: function(dx1, dy1, dx2, dy2, dx, dy) { + return this.push("c", slice.call(arguments)); + }, + close: function() { + return this.push("z"); } - originData = originData || ""; - this.path.setPathData(originData + g.pathToString(segment)); - return this; - }, - moveTo: function(x, y) { - return this.push("M", slice.call(arguments)); - }, - moveBy: function(dx, dy) { - return this.push("m", slice.call(arguments)); - }, - lineTo: function(x, y) { - return this.push("L", slice.call(arguments)); - }, - lineBy: function(dx, dy) { - return this.push("l", slice.call(arguments)); - }, - arcTo: function(rx, ry, xr, laf, sf, x, y) { - return this.push("A", slice.call(arguments)); - }, - arcBy: function(rx, ry, xr, laf, sf, dx, dy) { - return this.push("a", arguments); - }, - carcTo: function(r, laf, sf, x, y) { - return this.push("A", [ r, r, 0 ].concat(slice.call(arguments, 1))); - }, - carcBy: function(r, laf, sf, dx, dy) { - return this.push("a", [ r, r, 0 ].concat(slice.call(arguments, 1))); - }, - bezierTo: function(x1, y1, x2, y2, x, y) { - return this.push("C", slice.call(arguments)); - }, - bezierBy: function(dx1, dy1, dx2, dy2, dx, dy) { - return this.push("c", slice.call(arguments)); - }, - close: function() { - return this.push("z"); - } - }); - return createClass("Path", { - base: Shape, - constructor: function(data) { - this.callBase("path"); - if (data) { - this.setPathData(data); - } - this.node.setAttribute("fill", svg.defaults.fill); - this.node.setAttribute("stroke", svg.defaults.stroke); - }, - setPathData: function(data) { - data = data || "M0,0"; - this.pathdata = g.pathToString(data); - this.node.setAttribute("d", this.pathdata); - this.trigger("shapeupdate", { - type: "pathdata" - }); - return this; - }, - getPathData: function() { - return this.pathdata || ""; - }, - getDrawer: function() { - return new PathDrawer(this); - }, - isClosed: function() { - var data = this.getPathData(); - return !!~data.indexOf("z") || !!~data.indexOf("Z"); - } - }); -}); -define("graphic/patternbrush", [ "graphic/defbrush", "core/class", "graphic/resource", "graphic/shapecontainer", "graphic/container", "core/utils", "graphic/shape", "graphic/svg" ], function(require, exports, module) { - var DefBrush = require("graphic/defbrush"); - var ShapeContainer = require("graphic/shapecontainer"); - var svg = require("graphic/svg"); - return require("core/class").createClass("PatternBrush", { - base: DefBrush, - mixins: [ ShapeContainer ], - constructor: function() { - this.callBase("pattern"); - this.node.setAttribute("patternUnits", "userSpaceOnUse"); - }, - setX: function(x) { - this.x = x; - this.node.setAttribute("x", x); - return this; - }, - setY: function(y) { - this.y = y; - this.node.setAttribute("y", y); - return this; - }, - setWidth: function(width) { - this.width = width; - this.node.setAttribute("width", width); - return this; - }, - setHeight: function(height) { - this.height = height; - this.node.setAttribute("height", height); - return this; - }, - getWidth: function() { - return this.width; - }, - getHeight: function() { - return this.height; - } - }); -}); -define("graphic/pen", [ "graphic/color", "core/utils", "graphic/standardcolor", "core/class" ], function(require, exports, module) { - var Color = require("graphic/color"); - return require("core/class").createClass("Pen", { - constructor: function(brush, width) { - this.brush = brush; - this.width = width || 1; - this.linecap = null; - this.linejoin = null; - this.dashArray = null; - this.opacity = 1; - }, - getBrush: function() { - return this.brush; - }, - setBrush: function(brush) { - this.brush = brush; - return this; - }, - setColor: function(color) { - return this.setBrush(color); - }, - getColor: function() { - return this.brush instanceof Color ? this.brush : null; - }, - getWidth: function() { - return this.width; - }, - setWidth: function(width) { - this.width = width; - return this; - }, - getOpacity: function() { - return this.opacity; - }, - setOpacity: function(opacity) { - this.opacity = opacity; - }, - getLineCap: function() { - return this.linecap; - }, - setLineCap: function(linecap) { - this.linecap = linecap; - return this; - }, - getLineJoin: function() { - return this.linejoin; - }, - setLineJoin: function(linejoin) { - this.linejoin = linejoin; - return this; - }, - getDashArray: function() { - return this.dashArray; - }, - setDashArray: function(dashArray) { - this.dashArray = dashArray; - return this; - }, - stroke: function(shape) { - var node = shape.node; - node.setAttribute("stroke", this.brush.toString()); - node.setAttribute("stroke-width", this.getWidth()); - if (this.getOpacity() < 1) { - node.setAttribute("stroke-opacity", this.getOpacity()); + }); + return createClass("Path", { + base: Shape, + constructor: function(data) { + this.callBase("path"); + if (data) { + this.setPathData(data); + } + this.node.setAttribute("fill", svg.defaults.fill); + this.node.setAttribute("stroke", svg.defaults.stroke); + }, + setPathData: function(data) { + data = data || "M0,0"; + this.pathdata = g.pathToString(data); + this.node.setAttribute("d", this.pathdata); + this.trigger("shapeupdate", { + type: "pathdata" + }); + return this; + }, + getPathData: function() { + return this.pathdata || ""; + }, + getDrawer: function() { + return new PathDrawer(this); + }, + isClosed: function() { + var data = this.getPathData(); + return !!~data.indexOf("z") || !!~data.indexOf("Z"); } - if (this.getLineCap()) { - node.setAttribute("stroke-linecap", this.getLineCap()); + }); + } +}; + +//src/graphic/patternbrush.js +_p[48] = { + value: function(require, exports, module) { + var DefBrush = _p.r(32); + var ShapeContainer = _p.r(62); + var svg = _p.r(68); + return _p.r(11).createClass("PatternBrush", { + base: DefBrush, + mixins: [ ShapeContainer ], + constructor: function() { + this.callBase("pattern"); + this.node.setAttribute("patternUnits", "userSpaceOnUse"); + }, + setX: function(x) { + this.x = x; + this.node.setAttribute("x", x); + return this; + }, + setY: function(y) { + this.y = y; + this.node.setAttribute("y", y); + return this; + }, + setWidth: function(width) { + this.width = width; + this.node.setAttribute("width", width); + return this; + }, + setHeight: function(height) { + this.height = height; + this.node.setAttribute("height", height); + return this; + }, + getWidth: function() { + return this.width; + }, + getHeight: function() { + return this.height; } - if (this.getLineJoin()) { - node.setAttribute("stroke-linejoin", this.getLineJoin()); + }); + } +}; + +//src/graphic/pen.js +_p[49] = { + value: function(require, exports, module) { + var Color = _p.r(28); + return _p.r(11).createClass("Pen", { + constructor: function(brush, width) { + this.brush = brush; + this.width = width || 1; + this.linecap = null; + this.linejoin = null; + this.dashArray = null; + this.opacity = 1; + }, + getBrush: function() { + return this.brush; + }, + setBrush: function(brush) { + this.brush = brush; + return this; + }, + setColor: function(color) { + return this.setBrush(color); + }, + getColor: function() { + return this.brush instanceof Color ? this.brush : null; + }, + getWidth: function() { + return this.width; + }, + setWidth: function(width) { + this.width = width; + return this; + }, + getOpacity: function() { + return this.opacity; + }, + setOpacity: function(opacity) { + this.opacity = opacity; + }, + getLineCap: function() { + return this.linecap; + }, + setLineCap: function(linecap) { + this.linecap = linecap; + return this; + }, + getLineJoin: function() { + return this.linejoin; + }, + setLineJoin: function(linejoin) { + this.linejoin = linejoin; + return this; + }, + getDashArray: function() { + return this.dashArray; + }, + setDashArray: function(dashArray) { + this.dashArray = dashArray; + return this; + }, + stroke: function(shape) { + var node = shape.node; + node.setAttribute("stroke", this.brush.toString()); + node.setAttribute("stroke-width", this.getWidth()); + if (this.getOpacity() < 1) { + node.setAttribute("stroke-opacity", this.getOpacity()); + } + if (this.getLineCap()) { + node.setAttribute("stroke-linecap", this.getLineCap()); + } + if (this.getLineJoin()) { + node.setAttribute("stroke-linejoin", this.getLineJoin()); + } + if (this.getDashArray()) { + node.setAttribute("stroke-dasharray", this.getDashArray()); + } } - if (this.getDashArray()) { - node.setAttribute("stroke-dasharray", this.getDashArray()); + }); + } +}; + +//src/graphic/pie.js +_p[50] = { + value: function(require, exports, module) { + return _p.r(11).createClass({ + base: _p.r(69), + constructor: function(radius, angle, angleOffset) { + this.callBase([ 0, radius ], angle, angleOffset); + }, + getRadius: function() { + return this.getSectionArray()[1]; + }, + setRadius: function(radius) { + this.setSectionArray([ 0, radius ]); } - } - }); -}); -define("graphic/pie", [ "core/class", "graphic/sweep", "graphic/point", "graphic/path" ], function(require, exports, module) { - return require("core/class").createClass({ - base: require("graphic/sweep"), - constructor: function(radius, angle, angleOffset) { - this.callBase([ 0, radius ], angle, angleOffset); - }, - getRadius: function() { - return this.getSectionArray()[1]; - }, - setRadius: function(radius) { - this.setSectionArray([ 0, radius ]); - } - }); -}); + }); + } +}; + +//src/graphic/point.js /* * 点对象抽象 */ -define("graphic/point", [ "core/class" ], function(require, exports, module) { - /** +_p[51] = { + value: function(require, exports, module) { + /** * @class kity.Point * @description 表示一个点 */ - var Point = require("core/class").createClass("Point", { - /** + var Point = _p.r(11).createClass("Point", { + /** * @constructor * @for kity.Point * @description 指定默认的 x 和 y 创建一个点 @@ -5991,40 +6320,40 @@ define("graphic/point", [ "core/class" ], function(require, exports, module) { * @param {Number} x 点的 x 坐标 * @param {Number} y 点的 y 坐标 */ - constructor: function(x, y) { - /** + constructor: function(x, y) { + /** * @property * @for kity.Point * @description 表示点的 x 坐标 * @type {Number} */ - this.x = x || 0; - /** + this.x = x || 0; + /** * @property * @for kity.Point * @description 表示点的 y 坐标 * @type {Number} */ - this.y = y || 0; - }, - offset: function(dx, dy) { - if (arguments.length == 1) { - dy = dx.y; - dx = dx.x; + this.y = y || 0; + }, + offset: function(dx, dy) { + if (arguments.length == 1) { + dy = dx.y; + dx = dx.x; + } + return new Point(this.x + dx, this.y + dy); + }, + valueOf: function() { + return [ this.x, this.y ]; + }, + toString: function() { + return this.valueOf().join(" "); + }, + spof: function() { + return new Point((this.x | 0) + .5, (this.y | 0) + .5); } - return new Point(this.x + dx, this.y + dy); - }, - valueOf: function() { - return [ this.x, this.y ]; - }, - toString: function() { - return this.valueOf().join(" "); - }, - spof: function() { - return new Point((this.x | 0) + .5, (this.y | 0) + .5); - } - }); - /** + }); + /** * @static * @method fromPolar() * @for kity.Point @@ -6033,185 +6362,209 @@ define("graphic/point", [ "core/class" ], function(require, exports, module) { * @param {Number} angle 极坐标中的角度 * @param {String} unit 角度使用的单位,默认为 'deg' (角度),可以取值为 'rad',表示传入的是弧度值 */ - Point.fromPolar = function(radius, angle, unit) { - if (unit != "rad") { - // deg to rad - angle = angle / 180 * Math.PI; - } - return new Point(radius * Math.cos(angle), radius * Math.sin(angle)); - }; - Point.parse = function(unknown) { - if (unknown instanceof Point) { - return unknown; - } - if (typeof unknown == "string") { - return Point.parse(unknown.split(/\s*[\s,]\s*/)); - } - if ("0" in unknown && "1" in unknown) { - return new Point(unknown[0], unknown[1]); - } - }; - return Point; -}); + Point.fromPolar = function(radius, angle, unit) { + if (unit != "rad") { + // deg to rad + angle = angle / 180 * Math.PI; + } + return new Point(radius * Math.cos(angle), radius * Math.sin(angle)); + }; + Point.parse = function(unknown) { + if (unknown instanceof Point) { + return unknown; + } + if (typeof unknown == "string") { + return Point.parse(unknown.split(/\s*[\s,]\s*/)); + } + if ("0" in unknown && "1" in unknown) { + return new Point(unknown[0], unknown[1]); + } + }; + return Point; + } +}; + +//src/graphic/pointcontainer.js /** * 点集合容器 */ -define("graphic/pointcontainer", [ "core/class", "graphic/container" ], function(require, exports, module) { - return require("core/class").createClass("PointContainer", { - base: require("graphic/container"), - constructor: function() { - this.callBase(); - }, - addPoint: function(point, pos) { - return this.addItem.apply(this, arguments); - }, - prependPoint: function() { - return this.prependItem.apply(this, arguments); - }, - appendPoint: function() { - return this.appendItem.apply(this, arguments); - }, - removePoint: function(pos) { - return this.removeItem.apply(this, arguments); - }, - addPoints: function() { - return this.addItems.apply(this, arguments); - }, - setPoints: function() { - return this.setItems.apply(this, arguments); - }, - getPoint: function() { - return this.getItem.apply(this, arguments); - }, - getPoints: function() { - return this.getItems.apply(this, arguments); - }, - getFirstPoint: function() { - return this.getFirstItem.apply(this, arguments); - }, - getLastPoint: function() { - return this.getLastItem.apply(this, arguments); - } - }); -}); +_p[52] = { + value: function(require, exports, module) { + return _p.r(11).createClass("PointContainer", { + base: _p.r(29), + constructor: function() { + this.callBase(); + }, + addPoint: function(point, pos) { + return this.addItem.apply(this, arguments); + }, + prependPoint: function() { + return this.prependItem.apply(this, arguments); + }, + appendPoint: function() { + return this.appendItem.apply(this, arguments); + }, + removePoint: function(pos) { + return this.removeItem.apply(this, arguments); + }, + addPoints: function() { + return this.addItems.apply(this, arguments); + }, + setPoints: function() { + return this.setItems.apply(this, arguments); + }, + getPoint: function() { + return this.getItem.apply(this, arguments); + }, + getPoints: function() { + return this.getItems.apply(this, arguments); + }, + getFirstPoint: function() { + return this.getFirstItem.apply(this, arguments); + }, + getLastPoint: function() { + return this.getLastItem.apply(this, arguments); + } + }); + } +}; + +//src/graphic/poly.js /* * 通过点来决定图形的公共父类 */ -define("graphic/poly", [ "core/utils", "core/class", "graphic/path", "graphic/shape", "graphic/svg", "graphic/geometry", "graphic/pointcontainer", "graphic/container" ], function(require, exports, module) { - var Utils = require("core/utils"); - return require("core/class").createClass("Poly", { - base: require("graphic/path"), - mixins: [ require("graphic/pointcontainer") ], - constructor: function(points, closeable) { - this.callBase(); - //是否可闭合 - this.closeable = !!closeable; - this.setPoints(points || []); - this.changeable = true; - this.update(); - }, - //当点集合发生变化时采取的动作 - onContainerChanged: function() { - if (this.changeable) { +_p[53] = { + value: function(require, exports, module) { + var Utils = _p.r(12); + return _p.r(11).createClass("Poly", { + base: _p.r(47), + mixins: [ _p.r(52) ], + constructor: function(points, closeable) { + this.callBase(); + //是否可闭合 + this.closeable = !!closeable; + this.setPoints(points || []); + this.changeable = true; this.update(); - } - }, - update: function() { - var drawer = this.getDrawer(), points = this.getPoints(); - drawer.clear(); - if (!points.length) { + }, + //当点集合发生变化时采取的动作 + onContainerChanged: function() { + if (this.changeable) { + this.update(); + } + }, + update: function() { + var drawer = this.getDrawer(), points = this.getPoints(); + drawer.clear(); + if (!points.length) { + return this; + } + drawer.moveTo(points[0]); + for (var i = 1, point, len = points.length; i < len; i++) { + point = points[i]; + drawer.lineTo(point); + } + if (this.closeable && points.length > 2) { + drawer.close(); + } return this; } - drawer.moveTo(points[0]); - for (var i = 1, point, len = points.length; i < len; i++) { - point = points[i]; - drawer.lineTo(point); + }); + } +}; + +//src/graphic/polygon.js +_p[54] = { + value: function(require, exports, module) { + return _p.r(11).createClass("Polygon", { + base: _p.r(53), + constructor: function(points) { + this.callBase(points, true); } - if (this.closeable && points.length > 2) { - drawer.close(); + }); + } +}; + +//src/graphic/polyline.js +_p[55] = { + value: function(require, exports, module) { + return _p.r(11).createClass("Polyline", { + base: _p.r(53), + constructor: function(points) { + this.callBase(points); } - return this; - } - }); -}); -define("graphic/polygon", [ "core/class", "graphic/poly", "core/utils", "graphic/path", "graphic/pointcontainer" ], function(require, exports, module) { - return require("core/class").createClass("Polygon", { - base: require("graphic/poly"), - constructor: function(points) { - this.callBase(points, true); - } - }); -}); -define("graphic/polyline", [ "core/class", "graphic/poly", "core/utils", "graphic/path", "graphic/pointcontainer" ], function(require, exports, module) { - return require("core/class").createClass("Polyline", { - base: require("graphic/poly"), - constructor: function(points) { - this.callBase(points); - } - }); -}); -define("graphic/radialgradientbrush", [ "graphic/gradientbrush", "graphic/svg", "graphic/defbrush", "graphic/color", "core/class" ], function(require, exports, module) { - var GradientBrush = require("graphic/gradientbrush"); - return require("core/class").createClass("RadialGradientBrush", { - base: GradientBrush, - constructor: function(builder) { - this.callBase("radialGradient"); - this.setCenter(.5, .5); - this.setFocal(.5, .5); - this.setRadius(.5); - if (typeof builder == "function") { - builder.call(this, this); + }); + } +}; + +//src/graphic/radialgradientbrush.js +_p[56] = { + value: function(require, exports, module) { + var GradientBrush = _p.r(36); + return _p.r(11).createClass("RadialGradientBrush", { + base: GradientBrush, + constructor: function(builder) { + this.callBase("radialGradient"); + this.setCenter(.5, .5); + this.setFocal(.5, .5); + this.setRadius(.5); + if (typeof builder == "function") { + builder.call(this, this); + } + }, + setCenter: function(cx, cy) { + this.node.setAttribute("cx", cx); + this.node.setAttribute("cy", cy); + return this; + }, + getCenter: function() { + return { + x: +this.node.getAttribute("cx"), + y: +this.node.getAttribute("cy") + }; + }, + setFocal: function(fx, fy) { + this.node.setAttribute("fx", fx); + this.node.setAttribute("fy", fy); + return this; + }, + getFocal: function() { + return { + x: +this.node.getAttribute("fx"), + y: +this.node.getAttribute("fy") + }; + }, + setRadius: function(r) { + this.node.setAttribute("r", r); + return this; + }, + getRadius: function() { + return +this.node.getAttribute("r"); } - }, - setCenter: function(cx, cy) { - this.node.setAttribute("cx", cx); - this.node.setAttribute("cy", cy); - return this; - }, - getCenter: function() { - return { - x: +this.node.getAttribute("cx"), - y: +this.node.getAttribute("cy") - }; - }, - setFocal: function(fx, fy) { - this.node.setAttribute("fx", fx); - this.node.setAttribute("fy", fy); - return this; - }, - getFocal: function() { - return { - x: +this.node.getAttribute("fx"), - y: +this.node.getAttribute("fy") - }; - }, - setRadius: function(r) { - this.node.setAttribute("r", r); - return this; - }, - getRadius: function() { - return +this.node.getAttribute("r"); - } - }); -}); -define("graphic/rect", [ "core/utils", "graphic/point", "core/class", "graphic/box", "graphic/path", "graphic/shape", "graphic/svg", "graphic/geometry" ], function(require, exports, module) { - var RectUtils = {}, Utils = require("core/utils"), Point = require("graphic/point"), Box = require("graphic/box"); - Utils.extend(RectUtils, { - //根据传递进来的width、height和radius属性, - //获取最适合的radius值 - formatRadius: function(width, height, radius) { - var minValue = Math.floor(Math.min(width / 2, height / 2)); - return Math.min(minValue, radius); - } - }); - /** + }); + } +}; + +//src/graphic/rect.js +_p[57] = { + value: function(require, exports, module) { + var RectUtils = {}, Utils = _p.r(12), Point = _p.r(51), Box = _p.r(25); + Utils.extend(RectUtils, { + //根据传递进来的width、height和radius属性, + //获取最适合的radius值 + formatRadius: function(width, height, radius) { + var minValue = Math.floor(Math.min(width / 2, height / 2)); + return Math.min(minValue, radius); + } + }); + /** * @class kity.Rect * @description 表示一个矩形 * @base kity.Path */ - var Rect = require("core/class").createClass("Rect", { - base: require("graphic/path"), - /** + var Rect = _p.r(11).createClass("Rect", { + base: _p.r(47), + /** * @constructor * @for kity.Rect * @grammar new kity.Rect(width, height, x, y, radius) @@ -6221,44 +6574,44 @@ define("graphic/rect", [ "core/utils", "graphic/point", "core/class", "graphic/b * @param {Number} y 矩形的初始化 y 坐标 * @param {Number} radius 矩形的初始化圆角大小 */ - constructor: function(width, height, x, y, radius) { - this.callBase(); - this.x = x || 0; - this.y = y || 0; - this.width = width || 0; - this.height = height || 0; - this.radius = RectUtils.formatRadius(this.width, this.height, radius || 0); - this.update(); - }, - update: function() { - var x = this.x, y = this.y, w = this.width, h = this.height, r = this.radius; - var drawer = this.getDrawer().redraw(); - if (!r) { - // 直角 - drawer.push("M", x, y); - drawer.push("h", w); - drawer.push("v", h); - drawer.push("h", -w); - drawer.push("z"); - } else { - //圆角 - w -= 2 * r; - h -= 2 * r; - drawer.push("M", x + r, y); - drawer.push("h", w); - drawer.push("a", r, r, 0, 0, 1, r, r); - drawer.push("v", h); - drawer.push("a", r, r, 0, 0, 1, -r, r); - drawer.push("h", -w); - drawer.push("a", r, r, 0, 0, 1, -r, -r); - drawer.push("v", -h); - drawer.push("a", r, r, 0, 0, 1, r, -r); - drawer.push("z"); - } - drawer.done(); - return this; - }, - /** + constructor: function(width, height, x, y, radius) { + this.callBase(); + this.x = x || 0; + this.y = y || 0; + this.width = width || 0; + this.height = height || 0; + this.radius = RectUtils.formatRadius(this.width, this.height, radius || 0); + this.update(); + }, + update: function() { + var x = this.x, y = this.y, w = this.width, h = this.height, r = this.radius; + var drawer = this.getDrawer().redraw(); + if (!r) { + // 直角 + drawer.push("M", x, y); + drawer.push("h", w); + drawer.push("v", h); + drawer.push("h", -w); + drawer.push("z"); + } else { + //圆角 + w -= 2 * r; + h -= 2 * r; + drawer.push("M", x + r, y); + drawer.push("h", w); + drawer.push("a", r, r, 0, 0, 1, r, r); + drawer.push("v", h); + drawer.push("a", r, r, 0, 0, 1, -r, r); + drawer.push("h", -w); + drawer.push("a", r, r, 0, 0, 1, -r, -r); + drawer.push("v", -h); + drawer.push("a", r, r, 0, 0, 1, r, -r); + drawer.push("z"); + } + drawer.done(); + return this; + }, + /** * @method setWidth * @for kity.Rect * @grammar setWidth(width) => kity.Rect @@ -6270,11 +6623,11 @@ define("graphic/rect", [ "core/utils", "graphic/point", "core/class", "graphic/b * rect.setWidth(300); * ``` */ - setWidth: function(width) { - this.width = width; - return this.update(); - }, - /** + setWidth: function(width) { + this.width = width; + return this.update(); + }, + /** * @method setHeight * @for kity.Rect * @grammar setHeight(height) => kity.Rect @@ -6286,11 +6639,11 @@ define("graphic/rect", [ "core/utils", "graphic/point", "core/class", "graphic/b * rect.setHeight(200); * ``` */ - setHeight: function(height) { - this.height = height; - return this.update(); - }, - /** + setHeight: function(height) { + this.height = height; + return this.update(); + }, + /** * @method setSize * @for kity.Rect * @grammar setSize(width, height) => kity.Rect @@ -6303,1442 +6656,1522 @@ define("graphic/rect", [ "core/utils", "graphic/point", "core/class", "graphic/b * rect.setSize(300, 200); * ``` */ - setSize: function(width, height) { - this.width = width; - this.height = height; - return this.update(); - }, - /** + setSize: function(width, height) { + this.width = width; + this.height = height; + return this.update(); + }, + /** * @method setBox * @for kity.Rect * @grammar setBox(box) => kity.Rect * @description 使用一个 kity 的盒子数据, * @param {kity.Box} box 盒子数据 */ - setBox: function(box) { - this.x = box.x; - this.y = box.y; - this.width = box.width; - this.height = box.height; - return this.update(); - }, - getBox: function() { - return new Box(this.x, this.y, this.width, this.height); - }, - getRadius: function() { - return this.radius; - }, - setRadius: function(radius) { - this.radius = radius; - return this.update(); - }, - getPosition: function() { - return new Point(this.x, this.y); - }, - setPosition: function(x, y) { - if (arguments.length == 1) { - var p = Point.parse(arguments[0]); - y = p.y; - x = p.x; - } - this.x = x; - this.y = y; - return this.update(); - }, - getWidth: function() { - return this.width; - }, - getHeight: function() { - return this.height; - }, - getPositionX: function() { - return this.x; - }, - getPositionY: function() { - return this.y; - }, - setPositionX: function(x) { - this.x = x; - return this.update(); - }, - setPositionY: function(y) { - this.y = y; - return this.update(); - } - }); - return Rect; -}); -define("graphic/regularpolygon", [ "graphic/point", "core/class", "graphic/path", "core/utils", "graphic/shape", "graphic/svg", "graphic/geometry" ], function(require, exports, module) { - var Point = require("graphic/point"); - return require("core/class").createClass("RegularPolygon", { - base: require("graphic/path"), - constructor: function(side, radius, x, y) { - this.callBase(); - this.radius = radius || 0; - this.side = Math.max(side || 3, 3); - if (arguments.length > 2) { - if (arguments.length == 3) { - y = x.y; - x = x.x; + setBox: function(box) { + this.x = box.x; + this.y = box.y; + this.width = box.width; + this.height = box.height; + return this.update(); + }, + getBox: function() { + return new Box(this.x, this.y, this.width, this.height); + }, + getRadius: function() { + return this.radius; + }, + setRadius: function(radius) { + this.radius = radius; + return this.update(); + }, + getPosition: function() { + return new Point(this.x, this.y); + }, + setPosition: function(x, y) { + if (arguments.length == 1) { + var p = Point.parse(arguments[0]); + y = p.y; + x = p.x; } + this.x = x; + this.y = y; + return this.update(); + }, + getWidth: function() { + return this.width; + }, + getHeight: function() { + return this.height; + }, + getPositionX: function() { + return this.x; + }, + getPositionY: function() { + return this.y; + }, + setPositionX: function(x) { + this.x = x; + return this.update(); + }, + setPositionY: function(y) { + this.y = y; + return this.update(); } - this.center = new Point(x, y); - this.draw(); - }, - getSide: function() { - return this.side; - }, - setSide: function(side) { - this.side = side; - return this.draw(); - }, - getRadius: function() { - return this.radius; - }, - setRadius: function(radius) { - this.radius = radius; - return this.draw(); - }, - draw: function() { - var radius = this.radius, side = this.side, step = Math.PI * 2 / side, drawer = this.getDrawer(), i; - drawer.clear(); - drawer.moveTo(Point.fromPolar(radius, Math.PI / 2, "rad").offset(this.center)); - for (i = 0; i <= side; i++) { - drawer.lineTo(Point.fromPolar(radius, step * i + Math.PI / 2, "rad").offset(this.center)); - } - drawer.close(); - return this; - } - }); -}); -define("graphic/resource", [ "graphic/svg", "core/class" ], function(require, exports, module) { - var svg = require("graphic/svg"); - return require("core/class").createClass("Resource", { - constructor: function(nodeType) { - this.callBase(); - this.node = svg.createNode(nodeType); - }, - toString: function() { - return "url(#" + this.node.id + ")"; - } - }); -}); -define("graphic/ring", [ "core/class", "graphic/sweep", "graphic/point", "graphic/path" ], function(require, exports, module) { - return require("core/class").createClass({ - base: require("graphic/sweep"), - constructor: function(innerRadius, outerRadius) { - this.callBase([ innerRadius, outerRadius ], 360, 0); - }, - getInnerRadius: function() { - return this.getSectionArray()[0]; - }, - getOuterRadius: function() { - return this.getSectionArray()[1]; - }, - setInnerRadius: function(value) { - this.setSectionArray([ value, this.getOuterRadius() ]); - }, - setOuterRadius: function(value) { - this.setSectionArray([ this.getInnerRadius(), value ]); - } - }); -}); -define("graphic/shape", [ "graphic/svg", "core/utils", "graphic/eventhandler", "graphic/shapeevent", "core/class", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/box", "graphic/point", "graphic/pen", "graphic/color" ], function(require, exports, module) { - var svg = require("graphic/svg"); - var utils = require("core/utils"); - var EventHandler = require("graphic/eventhandler"); - var Styled = require("graphic/styled"); - var Data = require("graphic/data"); - var Matrix = require("graphic/matrix"); - var Pen = require("graphic/pen"); - var slice = Array.prototype.slice; - var Box = require("graphic/box"); - var Shape = require("core/class").createClass("Shape", { - mixins: [ EventHandler, Styled, Data ], - constructor: function Shape(tagName) { - this.node = svg.createNode(tagName); - this.node.shape = this; - this.transform = { - translate: null, - rotate: null, - scale: null, - matrix: null - }; - this.callMixin(); - }, - getId: function() { - return this.node.id; - }, - setId: function(id) { - this.node.id = id; - return this; - }, - getNode: function() { - return this.node; - }, - getBoundaryBox: function() { - var box; - try { - box = this.node.getBBox(); - } catch (e) { - box = { - x: this.node.clientLeft, - y: this.node.clientTop, - width: this.node.clientWidth, - height: this.node.clientHeight - }; - } - return new Box(box); - }, - getRenderBox: function(refer) { - var box = this.getBoundaryBox(); - var matrix = this.getTransform(refer); - return matrix.transformBox(box); - }, - getWidth: function() { - return this.getRenderBox().width; - }, - getHeight: function() { - return this.getRenderBox().height; - }, - getSize: function() { - var box = this.getRenderBox(); - delete box.x; - delete box.y; - return box; - }, - setOpacity: function(value) { - this.node.setAttribute("opacity", value); - return this; - }, - getOpacity: function() { - var opacity = this.node.getAttribute("opacity"); - return opacity ? +opacity : 1; - }, - setVisible: function(value) { - if (value) { - this.node.removeAttribute("display"); - } else { - this.node.setAttribute("display", "none"); - } - return this; - }, - getVisible: function() { - this.node.getAttribute("display"); - }, - hasAncestor: function(node) { - var parent = this.container; - while (parent) { - if (parent === node) { - return true; + }); + return Rect; + } +}; + +//src/graphic/regularpolygon.js +_p[58] = { + value: function(require, exports, module) { + var Point = _p.r(51); + return _p.r(11).createClass("RegularPolygon", { + base: _p.r(47), + constructor: function(side, radius, x, y) { + this.callBase(); + this.radius = radius || 0; + this.side = Math.max(side || 3, 3); + if (arguments.length > 2) { + if (arguments.length == 3) { + y = x.y; + x = x.x; + } } - parent = parent.container; - } - return false; - }, - getTransform: function(refer) { - return Matrix.getCTM(this, refer); - }, - clearTransform: function() { - this.node.removeAttribute("transform"); - this.transform = { - translate: null, - rotate: null, - scale: null, - matrix: null - }; - this.trigger("shapeupdate", { - type: "transform" - }); - return this; - }, - _applyTransform: function() { - var t = this.transform, result = []; - if (t.translate) { - result.push([ "translate(", t.translate, ")" ]); - } - if (t.rotate) { - result.push([ "rotate(", t.rotate, ")" ]); - } - if (t.scale) { - result.push([ "scale(", t.scale, ")" ]); - } - if (t.matrix) { - result.push([ "matrix(", t.matrix, ")" ]); - } - this.node.setAttribute("transform", utils.flatten(result).join(" ")); - return this; - }, - setMatrix: function(m) { - this.transform.matrix = m; - return this._applyTransform(); - }, - setTranslate: function(t) { - this.transform.translate = t !== null && slice.call(arguments) || null; - return this._applyTransform(); - }, - setRotate: function(r) { - this.transform.rotate = r !== null && slice.call(arguments) || null; - return this._applyTransform(); - }, - setScale: function(s) { - this.transform.scale = s !== null && slice.call(arguments) || null; - return this._applyTransform(); - }, - translate: function(dx, dy) { - var m = this.transform.matrix || new Matrix(); - if (dy === undefined) { - dy = 0; + this.center = new Point(x, y); + this.draw(); + }, + getSide: function() { + return this.side; + }, + setSide: function(side) { + this.side = side; + return this.draw(); + }, + getRadius: function() { + return this.radius; + }, + setRadius: function(radius) { + this.radius = radius; + return this.draw(); + }, + draw: function() { + var radius = this.radius, side = this.side, step = Math.PI * 2 / side, drawer = this.getDrawer(), i; + drawer.clear(); + drawer.moveTo(Point.fromPolar(radius, Math.PI / 2, "rad").offset(this.center)); + for (i = 0; i <= side; i++) { + drawer.lineTo(Point.fromPolar(radius, step * i + Math.PI / 2, "rad").offset(this.center)); + } + drawer.close(); + return this; } - this.transform.matrix = m.translate(dx, dy); - return this._applyTransform(); - }, - rotate: function(deg) { - var m = this.transform.matrix || new Matrix(); - this.transform.matrix = m.rotate(deg); - return this._applyTransform(); - }, - scale: function(sx, sy) { - var m = this.transform.matrix || new Matrix(); - if (sy === undefined) { - sy = sx; + }); + } +}; + +//src/graphic/resource.js +_p[59] = { + value: function(require, exports, module) { + var svg = _p.r(68); + return _p.r(11).createClass("Resource", { + constructor: function(nodeType) { + this.callBase(); + this.node = svg.createNode(nodeType); + }, + toString: function() { + return "url(#" + this.node.id + ")"; } - this.transform.matrix = m.scale(sx, sy); - return this._applyTransform(); - }, - skew: function(sx, sy) { - var m = this.transform.matrix || new Matrix(); - if (sy === undefined) { - sy = sx; + }); + } +}; + +//src/graphic/ring.js +_p[60] = { + value: function(require, exports, module) { + return _p.r(11).createClass({ + base: _p.r(69), + constructor: function(innerRadius, outerRadius) { + this.callBase([ innerRadius, outerRadius ], 360, 0); + }, + getInnerRadius: function() { + return this.getSectionArray()[0]; + }, + getOuterRadius: function() { + return this.getSectionArray()[1]; + }, + setInnerRadius: function(value) { + this.setSectionArray([ value, this.getOuterRadius() ]); + }, + setOuterRadius: function(value) { + this.setSectionArray([ this.getInnerRadius(), value ]); } - this.transform.matrix = m.skew(sx, sy); - return this._applyTransform(); - }, - stroke: function(pen, width) { - if (pen && pen.stroke) { - pen.stroke(this); - } else if (pen) { + }); + } +}; + +//src/graphic/shape.js +_p[61] = { + value: function(require, exports, module) { + var svg = _p.r(68); + var utils = _p.r(12); + var EventHandler = _p.r(34); + var Styled = _p.r(67); + var Data = _p.r(31); + var Matrix = _p.r(44); + var Pen = _p.r(49); + var slice = Array.prototype.slice; + var Box = _p.r(25); + var Shape = _p.r(11).createClass("Shape", { + mixins: [ EventHandler, Styled, Data ], + constructor: function Shape(tagName) { + this.node = svg.createNode(tagName); + this.node.shape = this; + this.transform = { + translate: null, + rotate: null, + scale: null, + matrix: null + }; + this.callMixin(); + }, + getId: function() { + return this.node.id; + }, + setId: function(id) { + this.node.id = id; + return this; + }, + getNode: function() { + return this.node; + }, + getBoundaryBox: function() { + var box; + try { + box = this.node.getBBox(); + } catch (e) { + box = { + x: this.node.clientLeft, + y: this.node.clientTop, + width: this.node.clientWidth, + height: this.node.clientHeight + }; + } + return new Box(box); + }, + getRenderBox: function(refer) { + var box = this.getBoundaryBox(); + var matrix = this.getTransform(refer); + return matrix.transformBox(box); + }, + getWidth: function() { + return this.getRenderBox().width; + }, + getHeight: function() { + return this.getRenderBox().height; + }, + getSize: function() { + var box = this.getRenderBox(); + delete box.x; + delete box.y; + return box; + }, + setOpacity: function(value) { + this.node.setAttribute("opacity", value); + return this; + }, + getOpacity: function() { + var opacity = this.node.getAttribute("opacity"); + return opacity ? +opacity : 1; + }, + setVisible: function(value) { + if (value) { + this.node.removeAttribute("display"); + } else { + this.node.setAttribute("display", "none"); + } + return this; + }, + getVisible: function() { + this.node.getAttribute("display"); + }, + hasAncestor: function(node) { + var parent = this.container; + while (parent) { + if (parent === node) { + return true; + } + parent = parent.container; + } + return false; + }, + getTransform: function(refer) { + return Matrix.getCTM(this, refer); + }, + clearTransform: function() { + this.node.removeAttribute("transform"); + this.transform = { + translate: null, + rotate: null, + scale: null, + matrix: null + }; + this.trigger("shapeupdate", { + type: "transform" + }); + return this; + }, + _applyTransform: function() { + var t = this.transform, result = []; + if (t.translate) { + result.push([ "translate(", t.translate, ")" ]); + } + if (t.rotate) { + result.push([ "rotate(", t.rotate, ")" ]); + } + if (t.scale) { + result.push([ "scale(", t.scale, ")" ]); + } + if (t.matrix) { + result.push([ "matrix(", t.matrix, ")" ]); + } + this.node.setAttribute("transform", utils.flatten(result).join(" ")); + return this; + }, + setMatrix: function(m) { + this.transform.matrix = m; + return this._applyTransform(); + }, + setTranslate: function(t) { + this.transform.translate = t !== null && slice.call(arguments) || null; + return this._applyTransform(); + }, + setRotate: function(r) { + this.transform.rotate = r !== null && slice.call(arguments) || null; + return this._applyTransform(); + }, + setScale: function(s) { + this.transform.scale = s !== null && slice.call(arguments) || null; + return this._applyTransform(); + }, + translate: function(dx, dy) { + var m = this.transform.matrix || new Matrix(); + if (dy === undefined) { + dy = 0; + } + this.transform.matrix = m.translate(dx, dy); + return this._applyTransform(); + }, + rotate: function(deg) { + var m = this.transform.matrix || new Matrix(); + this.transform.matrix = m.rotate(deg); + return this._applyTransform(); + }, + scale: function(sx, sy) { + var m = this.transform.matrix || new Matrix(); + if (sy === undefined) { + sy = sx; + } + this.transform.matrix = m.scale(sx, sy); + return this._applyTransform(); + }, + skew: function(sx, sy) { + var m = this.transform.matrix || new Matrix(); + if (sy === undefined) { + sy = sx; + } + this.transform.matrix = m.skew(sx, sy); + return this._applyTransform(); + }, + stroke: function(pen, width) { + if (pen && pen.stroke) { + pen.stroke(this); + } else if (pen) { + // 字符串或重写了 toString 的对象 + this.node.setAttribute("stroke", pen.toString()); + if (width) { + this.node.setAttribute("stroke-width", width); + } + } else if (pen === null) { + this.node.removeAttribute("stroe"); + } + return this; + }, + fill: function(brush) { // 字符串或重写了 toString 的对象 - this.node.setAttribute("stroke", pen.toString()); - if (width) { - this.node.setAttribute("stroke-width", width); + if (brush) { + this.node.setAttribute("fill", brush.toString()); } - } else if (pen === null) { - this.node.removeAttribute("stroe"); - } - return this; - }, - fill: function(brush) { - // 字符串或重写了 toString 的对象 - if (brush) { - this.node.setAttribute("fill", brush.toString()); - } - if (brush === null) { - this.node.removeAttribute("fill"); + if (brush === null) { + this.node.removeAttribute("fill"); + } + return this; + }, + setAttr: function(a, v) { + var me = this; + if (utils.isObject(a)) { + utils.each(a, function(val, key) { + me.setAttr(key, val); + }); + } + if (v === undefined || v === null || v === "") { + this.node.removeAttribute(a); + } else { + this.node.setAttribute(a, v); + } + return this; + }, + getAttr: function(a) { + return this.node.getAttribute(a); } - return this; - }, - setAttr: function(a, v) { - var me = this; - if (utils.isObject(a)) { - utils.each(a, function(val, key) { - me.setAttr(key, val); + }); + return Shape; + } +}; + +//src/graphic/shapecontainer.js +_p[62] = { + value: function(require, exports, module) { + var Container = _p.r(29); + var utils = _p.r(12); + var ShapeContainer = _p.r(11).createClass("ShapeContainer", { + base: Container, + isShapeContainer: true, + /* private */ + handleAdd: function(shape, index) { + var parent = this.getShapeNode(); + parent.insertBefore(shape.node, parent.childNodes[index] || null); + shape.trigger("add", { + container: this }); - } - if (v === undefined || v === null || v === "") { - this.node.removeAttribute(a); - } else { - this.node.setAttribute(a, v); - } - return this; - }, - getAttr: function(a) { - return this.node.getAttribute(a); - } - }); - return Shape; -}); -define("graphic/shapecontainer", [ "graphic/container", "core/class", "core/utils", "graphic/shape", "graphic/svg", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box" ], function(require, exports, module) { - var Container = require("graphic/container"); - var utils = require("core/utils"); - var ShapeContainer = require("core/class").createClass("ShapeContainer", { - base: Container, - isShapeContainer: true, - /* private */ - handleAdd: function(shape, index) { - var parent = this.getShapeNode(); - parent.insertBefore(shape.node, parent.childNodes[index] || null); - shape.trigger("add", { - container: this - }); - if (shape.notifyTreeModification) { - shape.notifyTreeModification("treeadd", this); - } - }, - /* private */ - handleRemove: function(shape, index) { - var parent = this.getShapeNode(); - parent.removeChild(shape.node); - shape.trigger("remove", { - container: this - }); - if (shape.notifyTreeModification) { - shape.notifyTreeModification("treeremove", this); - } - }, - /* private */ - notifyTreeModification: function(type, container) { - this.eachItem(function(index, shape) { if (shape.notifyTreeModification) { - shape.notifyTreeModification(type, container); + shape.notifyTreeModification("treeadd", this); } - shape.trigger(type, { - container: container + }, + /* private */ + handleRemove: function(shape, index) { + var parent = this.getShapeNode(); + parent.removeChild(shape.node); + shape.trigger("remove", { + container: this }); - }); - }, - /* public */ - getShape: function(index) { - return this.getItem(index); - }, - /* public */ - addShape: function(shape, index) { - return this.addItem(shape, index); - }, - put: function(shape) { - this.addShape(shape); - return shape; - }, - appendShape: function(shape) { - return this.addShape(shape); - }, - prependShape: function(shape) { - return this.addShape(shape, 0); - }, - replaceShape: function(replacer, origin) { - var index = this.indexOf(origin); - if (index === -1) { - return; - } - this.removeShape(index); - this.addShape(replacer, index); - return this; - }, - addShapeBefore: function(shape, refer) { - var index = this.indexOf(refer); - return this.addShape(shape, index); - }, - addShapeAfter: function(shape, refer) { - var index = this.indexOf(refer); - return this.addShape(shape, index === -1 ? undefined : index + 1); - }, - /* public */ - addShapes: function(shapes) { - return this.addItems(shapes); - }, - /* public */ - removeShape: function(index) { - return this.removeItem(index); - }, - getShapes: function() { - return this.getItems(); - }, - getShapesByType: function(name) { - var shapes = []; - function getShapes(shape) { - if (name.toLowerCase() == shape.getType().toLowerCase()) { - shapes.push(shape); - } - if (shape.isShapeContainer) { - utils.each(shape.getShapes(), function(n) { - getShapes(n); + if (shape.notifyTreeModification) { + shape.notifyTreeModification("treeremove", this); + } + }, + /* private */ + notifyTreeModification: function(type, container) { + this.eachItem(function(index, shape) { + if (shape.notifyTreeModification) { + shape.notifyTreeModification(type, container); + } + shape.trigger(type, { + container: container }); + }); + }, + /* public */ + getShape: function(index) { + return this.getItem(index); + }, + /* public */ + addShape: function(shape, index) { + return this.addItem(shape, index); + }, + put: function(shape) { + this.addShape(shape); + return shape; + }, + appendShape: function(shape) { + return this.addShape(shape); + }, + prependShape: function(shape) { + return this.addShape(shape, 0); + }, + replaceShape: function(replacer, origin) { + var index = this.indexOf(origin); + if (index === -1) { + return; + } + this.removeShape(index); + this.addShape(replacer, index); + return this; + }, + addShapeBefore: function(shape, refer) { + var index = this.indexOf(refer); + return this.addShape(shape, index); + }, + addShapeAfter: function(shape, refer) { + var index = this.indexOf(refer); + return this.addShape(shape, index === -1 ? undefined : index + 1); + }, + /* public */ + addShapes: function(shapes) { + return this.addItems(shapes); + }, + /* public */ + removeShape: function(index) { + return this.removeItem(index); + }, + getShapes: function() { + return this.getItems(); + }, + getShapesByType: function(name) { + var shapes = []; + function getShapes(shape) { + if (name.toLowerCase() == shape.getType().toLowerCase()) { + shapes.push(shape); + } + if (shape.isShapeContainer) { + utils.each(shape.getShapes(), function(n) { + getShapes(n); + }); + } } + getShapes(this); + return shapes; + }, + /* public */ + getShapeById: function(id) { + return this.getShapeNode().getElementById(id).shape; + }, + arrangeShape: function(shape, index) { + return this.removeShape(shape).addShape(shape, index); + }, + /* protected */ + getShapeNode: function() { + return this.shapeNode || this.node; } - getShapes(this); - return shapes; - }, - /* public */ - getShapeById: function(id) { - return this.getShapeNode().getElementById(id).shape; - }, - arrangeShape: function(shape, index) { - return this.removeShape(shape).addShape(shape, index); - }, - /* protected */ - getShapeNode: function() { - return this.shapeNode || this.node; - } - }); - var Shape = require("graphic/shape"); - require("core/class").extendClass(Shape, { - bringTo: function(index) { - this.container.arrangeShape(this, index); - return this; - }, - bringFront: function() { - return this.bringTo(this.container.indexOf(this) + 1); - }, - bringBack: function() { - return this.bringTo(this.container.indexOf(this) - 1); - }, - bringTop: function() { - this.container.removeShape(this).addShape(this); - return this; - }, - bringRear: function() { - return this.bringTo(0); - }, - bringRefer: function(referShape, offset) { - if (referShape.container) { - if (this.remove) { + }); + var Shape = _p.r(61); + _p.r(11).extendClass(Shape, { + bringTo: function(index) { + this.container.arrangeShape(this, index); + return this; + }, + bringFront: function() { + return this.bringTo(this.container.indexOf(this) + 1); + }, + bringBack: function() { + return this.bringTo(this.container.indexOf(this) - 1); + }, + bringTop: function() { + this.container.removeShape(this).addShape(this); + return this; + }, + bringRear: function() { + return this.bringTo(0); + }, + bringRefer: function(referShape, offset) { + if (referShape.container) { + if (this.remove) { + this.remove(); + } + referShape.container.addShape(this, referShape.container.indexOf(referShape) + (offset || 0)); + } + return this; + }, + bringAbove: function(referShape) { + return this.bringRefer(referShape); + }, + bringBelow: function(referShape) { + return this.bringRefer(referShape, 1); + }, + replaceBy: function(newShape) { + if (this.container) { + newShape.bringAbove(this); this.remove(); } - referShape.container.addShape(this, referShape.container.indexOf(referShape) + (offset || 0)); - } - return this; - }, - bringAbove: function(referShape) { - return this.bringRefer(referShape); - }, - bringBelow: function(referShape) { - return this.bringRefer(referShape, 1); - }, - replaceBy: function(newShape) { - if (this.container) { - newShape.bringAbove(this); - this.remove(); + return this; } - return this; - } - }); - return ShapeContainer; -}); + }); + return ShapeContainer; + } +}; + +//src/graphic/shapeevent.js /* * 图形事件包装类 * */ -define("graphic/shapeevent", [ "graphic/matrix", "core/utils", "graphic/box", "graphic/point", "core/class" ], function(require, exprots, module) { - var Matrix = require("graphic/matrix"), Utils = require("core/utils"), Point = require("graphic/point"); - return require("core/class").createClass("ShapeEvent", { - constructor: function(event) { - var target = null; - // dom 事件封装对象 - if (!Utils.isObject(event.target)) { - this.type = event.type; - target = event.target; - // use标签有特殊属性, 需要区别对待 - if (target.correspondingUseElement) { - target = target.correspondingUseElement; - } - this.originEvent = event; - this.targetShape = target.shape || target.paper || event.currentTarget && (event.currentTarget.shape || event.currentTarget.paper); - if (event._kityParam) { - Utils.extend(this, event._kityParam); +_p[63] = { + value: function(require, exprots, module) { + var Matrix = _p.r(44), Utils = _p.r(12), Point = _p.r(51); + return _p.r(11).createClass("ShapeEvent", { + constructor: function(event) { + var target = null; + // dom 事件封装对象 + if (!Utils.isObject(event.target)) { + this.type = event.type; + target = event.target; + // use标签有特殊属性, 需要区别对待 + if (target.correspondingUseElement) { + target = target.correspondingUseElement; + } + this.originEvent = event; + this.targetShape = target.shape || target.paper || event.currentTarget && (event.currentTarget.shape || event.currentTarget.paper); + if (event._kityParam) { + Utils.extend(this, event._kityParam); + } + } else { + Utils.extend(this, event); + } + }, + preventDefault: function() { + var evt = this.originEvent; + if (!evt) { + return true; + } + if (evt.preventDefault) { + evt.preventDefault(); + return evt.cancelable; + } else { + evt.returnValue = false; + return true; + } + }, + //当前鼠标事件在用户坐标系中点击的点的坐标位置 + getPosition: function(refer, touchIndex) { + if (!this.originEvent) { + return null; + } + var eventClient = this.originEvent.touches ? this.originEvent.touches[touchIndex || 0] : this.originEvent; + var target = this.targetShape; + var targetNode = target.shapeNode || target.node; + var pScreen = new Point(eventClient && eventClient.clientX || 0, eventClient && eventClient.clientY || 0); + var pTarget = Matrix.transformPoint(pScreen, targetNode.getScreenCTM().inverse()); + var pRefer = Matrix.getCTM(target, refer || "view").transformPoint(pTarget); + return pRefer; + }, + stopPropagation: function() { + var evt = this.originEvent; + if (!evt) { + return true; + } + if (evt.stopPropagation) { + evt.stopPropagation(); + } else { + evt.cancelBubble = false; } - } else { - Utils.extend(this, event); - } - }, - preventDefault: function() { - var evt = this.originEvent; - if (!evt) { - return true; - } - if (evt.preventDefault) { - evt.preventDefault(); - return evt.cancelable; - } else { - evt.returnValue = false; - return true; - } - }, - //当前鼠标事件在用户坐标系中点击的点的坐标位置 - getPosition: function(refer, touchIndex) { - if (!this.originEvent) { - return null; - } - var eventClient = this.originEvent.touches ? this.originEvent.touches[touchIndex || 0] : this.originEvent; - var target = this.targetShape; - var targetNode = target.shapeNode || target.node; - var pScreen = new kity.Point(eventClient && eventClient.clientX || 0, eventClient && eventClient.clientY || 0); - var pTarget = Matrix.transformPoint(pScreen, targetNode.getScreenCTM().inverse()); - var pRefer = Matrix.getCTM(target, refer || "view").transformPoint(pTarget); - return pRefer; - }, - stopPropagation: function() { - var evt = this.originEvent; - if (!evt) { - return true; - } - if (evt.stopPropagation) { - evt.stopPropagation(); - } else { - evt.cancelBubble = false; } - } - }); -}); + }); + } +}; + +//src/graphic/shapepoint.js /* * 图形上的点抽象 */ -define("graphic/shapepoint", [ "core/class", "graphic/point" ], function(require, exports, module) { - return require("core/class").createClass("ShapePoint", { - base: require("graphic/point"), - constructor: function(px, py) { - this.callBase(px, py); - }, - setX: function(x) { - return this.setPoint(x, this.y); - }, - setY: function(y) { - return this.setPoint(this.x, y); - }, - setPoint: function(x, y) { - this.x = x; - this.y = y; - this.update(); - return this; - }, - getPoint: function() { - return this; - }, - update: function() { - if (this.container && this.container.update) { - this.container.update(); +_p[64] = { + value: function(require, exports, module) { + return _p.r(11).createClass("ShapePoint", { + base: _p.r(51), + constructor: function(px, py) { + this.callBase(px, py); + }, + setX: function(x) { + return this.setPoint(x, this.y); + }, + setY: function(y) { + return this.setPoint(this.x, y); + }, + setPoint: function(x, y) { + this.x = x; + this.y = y; + this.update(); + return this; + }, + getPoint: function() { + return this; + }, + update: function() { + if (this.container && this.container.update) { + this.container.update(); + } + return this; } - return this; - } - }); -}); + }); + } +}; + +//src/graphic/standardcolor.js /** * 标准颜色映射 */ -define("graphic/standardcolor", [], { - COLOR_STANDARD: { - aliceblue: "#f0f8ff", - antiquewhite: "#faebd7", - aqua: "#00ffff", - aquamarine: "#7fffd4", - azure: "#f0ffff", - beige: "#f5f5dc", - bisque: "#ffe4c4", - black: "#000000", - blanchedalmond: "#ffebcd", - blue: "#0000ff", - blueviolet: "#8a2be2", - brown: "#a52a2a", - burlywood: "#deb887", - cadetblue: "#5f9ea0", - chartreuse: "#7fff00", - chocolate: "#d2691e", - coral: "#ff7f50", - cornflowerblue: "#6495ed", - cornsilk: "#fff8dc", - crimson: "#dc143c", - cyan: "#00ffff", - darkblue: "#00008b", - darkcyan: "#008b8b", - darkgoldenrod: "#b8860b", - darkgray: "#a9a9a9", - darkgreen: "#006400", - darkgrey: "#a9a9a9", - darkkhaki: "#bdb76b", - darkmagenta: "#8b008b", - darkolivegreen: "#556b2f", - darkorange: "#ff8c00", - darkorchid: "#9932cc", - darkred: "#8b0000", - darksalmon: "#e9967a", - darkseagreen: "#8fbc8f", - darkslateblue: "#483d8b", - darkslategray: "#2f4f4f", - darkslategrey: "#2f4f4f", - darkturquoise: "#00ced1", - darkviolet: "#9400d3", - deeppink: "#ff1493", - deepskyblue: "#00bfff", - dimgray: "#696969", - dimgrey: "#696969", - dodgerblue: "#1e90ff", - firebrick: "#b22222", - floralwhite: "#fffaf0", - forestgreen: "#228b22", - fuchsia: "#ff00ff", - gainsboro: "#dcdcdc", - ghostwhite: "#f8f8ff", - gold: "#ffd700", - goldenrod: "#daa520", - gray: "#808080", - green: "#008000", - greenyellow: "#adff2f", - grey: "#808080", - honeydew: "#f0fff0", - hotpink: "#ff69b4", - indianred: "#cd5c5c", - indigo: "#4b0082", - ivory: "#fffff0", - khaki: "#f0e68c", - lavender: "#e6e6fa", - lavenderblush: "#fff0f5", - lawngreen: "#7cfc00", - lemonchiffon: "#fffacd", - lightblue: "#add8e6", - lightcoral: "#f08080", - lightcyan: "#e0ffff", - lightgoldenrodyellow: "#fafad2", - lightgray: "#d3d3d3", - lightgreen: "#90ee90", - lightgrey: "#d3d3d3", - lightpink: "#ffb6c1", - lightsalmon: "#ffa07a", - lightseagreen: "#20b2aa", - lightskyblue: "#87cefa", - lightslategray: "#778899", - lightslategrey: "#778899", - lightsteelblue: "#b0c4de", - lightyellow: "#ffffe0", - lime: "#00ff00", - limegreen: "#32cd32", - linen: "#faf0e6", - magenta: "#ff00ff", - maroon: "#800000", - mediumaquamarine: "#66cdaa", - mediumblue: "#0000cd", - mediumorchid: "#ba55d3", - mediumpurple: "#9370db", - mediumseagreen: "#3cb371", - mediumslateblue: "#7b68ee", - mediumspringgreen: "#00fa9a", - mediumturquoise: "#48d1cc", - mediumvioletred: "#c71585", - midnightblue: "#191970", - mintcream: "#f5fffa", - mistyrose: "#ffe4e1", - moccasin: "#ffe4b5", - navajowhite: "#ffdead", - navy: "#000080", - oldlace: "#fdf5e6", - olive: "#808000", - olivedrab: "#6b8e23", - orange: "#ffa500", - orangered: "#ff4500", - orchid: "#da70d6", - palegoldenrod: "#eee8aa", - palegreen: "#98fb98", - paleturquoise: "#afeeee", - palevioletred: "#db7093", - papayawhip: "#ffefd5", - peachpuff: "#ffdab9", - peru: "#cd853f", - pink: "#ffc0cb", - plum: "#dda0dd", - powderblue: "#b0e0e6", - purple: "#800080", - red: "#ff0000", - rosybrown: "#bc8f8f", - royalblue: "#4169e1", - saddlebrown: "#8b4513", - salmon: "#fa8072", - sandybrown: "#f4a460", - seagreen: "#2e8b57", - seashell: "#fff5ee", - sienna: "#a0522d", - silver: "#c0c0c0", - skyblue: "#87ceeb", - slateblue: "#6a5acd", - slategray: "#708090", - slategrey: "#708090", - snow: "#fffafa", - springgreen: "#00ff7f", - steelblue: "#4682b4", - tan: "#d2b48c", - teal: "#008080", - thistle: "#d8bfd8", - tomato: "#ff6347", - turquoise: "#40e0d0", - violet: "#ee82ee", - wheat: "#f5deb3", - white: "#ffffff", - whitesmoke: "#f5f5f5", - yellow: "#ffff00" - }, - //标准扩展 - EXTEND_STANDARD: {} -}); -define("graphic/star", [ "graphic/point", "core/class", "graphic/path", "core/utils", "graphic/shape", "graphic/svg", "graphic/geometry" ], function(require, exports, module) { - /** +_p[65] = { + value: { + COLOR_STANDARD: { + aliceblue: "#f0f8ff", + antiquewhite: "#faebd7", + aqua: "#00ffff", + aquamarine: "#7fffd4", + azure: "#f0ffff", + beige: "#f5f5dc", + bisque: "#ffe4c4", + black: "#000000", + blanchedalmond: "#ffebcd", + blue: "#0000ff", + blueviolet: "#8a2be2", + brown: "#a52a2a", + burlywood: "#deb887", + cadetblue: "#5f9ea0", + chartreuse: "#7fff00", + chocolate: "#d2691e", + coral: "#ff7f50", + cornflowerblue: "#6495ed", + cornsilk: "#fff8dc", + crimson: "#dc143c", + cyan: "#00ffff", + darkblue: "#00008b", + darkcyan: "#008b8b", + darkgoldenrod: "#b8860b", + darkgray: "#a9a9a9", + darkgreen: "#006400", + darkgrey: "#a9a9a9", + darkkhaki: "#bdb76b", + darkmagenta: "#8b008b", + darkolivegreen: "#556b2f", + darkorange: "#ff8c00", + darkorchid: "#9932cc", + darkred: "#8b0000", + darksalmon: "#e9967a", + darkseagreen: "#8fbc8f", + darkslateblue: "#483d8b", + darkslategray: "#2f4f4f", + darkslategrey: "#2f4f4f", + darkturquoise: "#00ced1", + darkviolet: "#9400d3", + deeppink: "#ff1493", + deepskyblue: "#00bfff", + dimgray: "#696969", + dimgrey: "#696969", + dodgerblue: "#1e90ff", + firebrick: "#b22222", + floralwhite: "#fffaf0", + forestgreen: "#228b22", + fuchsia: "#ff00ff", + gainsboro: "#dcdcdc", + ghostwhite: "#f8f8ff", + gold: "#ffd700", + goldenrod: "#daa520", + gray: "#808080", + green: "#008000", + greenyellow: "#adff2f", + grey: "#808080", + honeydew: "#f0fff0", + hotpink: "#ff69b4", + indianred: "#cd5c5c", + indigo: "#4b0082", + ivory: "#fffff0", + khaki: "#f0e68c", + lavender: "#e6e6fa", + lavenderblush: "#fff0f5", + lawngreen: "#7cfc00", + lemonchiffon: "#fffacd", + lightblue: "#add8e6", + lightcoral: "#f08080", + lightcyan: "#e0ffff", + lightgoldenrodyellow: "#fafad2", + lightgray: "#d3d3d3", + lightgreen: "#90ee90", + lightgrey: "#d3d3d3", + lightpink: "#ffb6c1", + lightsalmon: "#ffa07a", + lightseagreen: "#20b2aa", + lightskyblue: "#87cefa", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#b0c4de", + lightyellow: "#ffffe0", + lime: "#00ff00", + limegreen: "#32cd32", + linen: "#faf0e6", + magenta: "#ff00ff", + maroon: "#800000", + mediumaquamarine: "#66cdaa", + mediumblue: "#0000cd", + mediumorchid: "#ba55d3", + mediumpurple: "#9370db", + mediumseagreen: "#3cb371", + mediumslateblue: "#7b68ee", + mediumspringgreen: "#00fa9a", + mediumturquoise: "#48d1cc", + mediumvioletred: "#c71585", + midnightblue: "#191970", + mintcream: "#f5fffa", + mistyrose: "#ffe4e1", + moccasin: "#ffe4b5", + navajowhite: "#ffdead", + navy: "#000080", + oldlace: "#fdf5e6", + olive: "#808000", + olivedrab: "#6b8e23", + orange: "#ffa500", + orangered: "#ff4500", + orchid: "#da70d6", + palegoldenrod: "#eee8aa", + palegreen: "#98fb98", + paleturquoise: "#afeeee", + palevioletred: "#db7093", + papayawhip: "#ffefd5", + peachpuff: "#ffdab9", + peru: "#cd853f", + pink: "#ffc0cb", + plum: "#dda0dd", + powderblue: "#b0e0e6", + purple: "#800080", + red: "#ff0000", + rosybrown: "#bc8f8f", + royalblue: "#4169e1", + saddlebrown: "#8b4513", + salmon: "#fa8072", + sandybrown: "#f4a460", + seagreen: "#2e8b57", + seashell: "#fff5ee", + sienna: "#a0522d", + silver: "#c0c0c0", + skyblue: "#87ceeb", + slateblue: "#6a5acd", + slategray: "#708090", + slategrey: "#708090", + snow: "#fffafa", + springgreen: "#00ff7f", + steelblue: "#4682b4", + tan: "#d2b48c", + teal: "#008080", + thistle: "#d8bfd8", + tomato: "#ff6347", + turquoise: "#40e0d0", + violet: "#ee82ee", + wheat: "#f5deb3", + white: "#ffffff", + whitesmoke: "#f5f5f5", + yellow: "#ffff00" + }, + //标准扩展 + EXTEND_STANDARD: {} + } +}; + +//src/graphic/star.js +_p[66] = { + value: function(require, exports, module) { + /** * @see http://www.jdawiseman.com/papers/easymath/surds_star_inner_radius.html */ - var defaultRatioForStar = { - "3": .2, - // yy - "5": .38196601125, - "6": .57735026919, - "8": .541196100146, - "10": .726542528005, - "12": .707106781187 - }; - var Point = require("graphic/point"); - return require("core/class").createClass("Star", { - base: require("graphic/path"), - constructor: function(vertex, radius, shrink, offset, angleOffset) { - this.callBase(); - this.vertex = vertex || 3; - this.radius = radius || 0; - this.shrink = shrink; - this.offset = offset || new Point(0, 0); - this.angleOffset = angleOffset || 0; - this.draw(); - }, - getVertex: function() { - return this.vertex; - }, - setVertex: function(value) { - this.vertex = value; - return this.draw(); - }, - getRadius: function() { - return this.radius; - }, - setRadius: function(value) { - this.radius = value; - return this.draw(); - }, - getShrink: function() { - return this.shrink; - }, - setShrink: function(value) { - this.shrink = value; - return this.draw(); - }, - getOffset: function() { - return this.offset; - }, - setOffset: function(value) { - this.offset = value; - return this.draw(); - }, - getAngleOffset: function() { - return this.angleOffset; - }, - setAngleOffset: function(value) { - this.angleOffset = value; - return this.draw(); - }, - draw: function() { - var innerRadius = this.radius, outerRadius = this.radius * (this.shrink || defaultRatioForStar[this.vertex] || .5), vertex = this.vertex, offset = this.offset, angleStart = 90, angleStep = 180 / vertex, angleOffset = this.angleOffset, drawer = this.getDrawer(), i, angle; - drawer.clear(); - drawer.moveTo(Point.fromPolar(outerRadius, angleStart)); - for (i = 1; i <= vertex * 2; i++) { - angle = angleStart + angleStep * i; - // 绘制内点 - if (i % 2) { - drawer.lineTo(Point.fromPolar(innerRadius, angle + angleOffset).offset(offset)); - } else { - drawer.lineTo(Point.fromPolar(outerRadius, angle)); + var defaultRatioForStar = { + "3": .2, + // yy + "5": .38196601125, + "6": .57735026919, + "8": .541196100146, + "10": .726542528005, + "12": .707106781187 + }; + var Point = _p.r(51); + return _p.r(11).createClass("Star", { + base: _p.r(47), + constructor: function(vertex, radius, shrink, offset, angleOffset) { + this.callBase(); + this.vertex = vertex || 3; + this.radius = radius || 0; + this.shrink = shrink; + this.offset = offset || new Point(0, 0); + this.angleOffset = angleOffset || 0; + this.draw(); + }, + getVertex: function() { + return this.vertex; + }, + setVertex: function(value) { + this.vertex = value; + return this.draw(); + }, + getRadius: function() { + return this.radius; + }, + setRadius: function(value) { + this.radius = value; + return this.draw(); + }, + getShrink: function() { + return this.shrink; + }, + setShrink: function(value) { + this.shrink = value; + return this.draw(); + }, + getOffset: function() { + return this.offset; + }, + setOffset: function(value) { + this.offset = value; + return this.draw(); + }, + getAngleOffset: function() { + return this.angleOffset; + }, + setAngleOffset: function(value) { + this.angleOffset = value; + return this.draw(); + }, + draw: function() { + var innerRadius = this.radius, outerRadius = this.radius * (this.shrink || defaultRatioForStar[this.vertex] || .5), vertex = this.vertex, offset = this.offset, angleStart = 90, angleStep = 180 / vertex, angleOffset = this.angleOffset, drawer = this.getDrawer(), i, angle; + drawer.clear(); + drawer.moveTo(Point.fromPolar(outerRadius, angleStart)); + for (i = 1; i <= vertex * 2; i++) { + angle = angleStart + angleStep * i; + // 绘制内点 + if (i % 2) { + drawer.lineTo(Point.fromPolar(innerRadius, angle + angleOffset).offset(offset)); + } else { + drawer.lineTo(Point.fromPolar(outerRadius, angle)); + } } + drawer.close(); } - drawer.close(); - } - }); -}); -define("graphic/styled", [ "core/class" ], function(require, exports, module) { - // polyfill for ie - var ClassList = require("core/class").createClass("ClassList", { - constructor: function(node) { - this._node = node; - this._list = node.className.toString().split(" "); - }, - _update: function() { - this._node.className = this._list.join(" "); - }, - add: function(name) { - this._list.push(name); - this._update(); - }, - remove: function(name) { - var index = this._list.indexOf(name); - if (~index) { - this._list.splice(index, 1); - } - this._update(); - }, - contains: function(name) { - return !!~this._list.indexOf(name); - } - }); - function getClassList(node) { - if (!node.classList) { - node.classList = new ClassList(node); - } - return node.classList; + }); } - return require("core/class").createClass("Styled", { - addClass: function(name) { - getClassList(this.node).add(name); - return this; - }, - removeClass: function(name) { - getClassList(this.node).remove(name); - return this; - }, - hasClass: function(name) { - return getClassList(this.node).contains(name); - }, - setStyle: function(styles) { - if (arguments.length == 2) { - this.node.style[arguments[0]] = arguments[1]; - return this; - } - for (var name in styles) { - if (styles.hasOwnProperty(name)) { - this.node.style[name] = styles[name]; +}; + +//src/graphic/styled.js +_p[67] = { + value: function(require, exports, module) { + // polyfill for ie + var ClassList = _p.r(11).createClass("ClassList", { + constructor: function(node) { + this._node = node; + this._list = node.className.toString().split(" "); + }, + _update: function() { + this._node.className = this._list.join(" "); + }, + add: function(name) { + this._list.push(name); + this._update(); + }, + remove: function(name) { + var index = this._list.indexOf(name); + if (~index) { + this._list.splice(index, 1); } + this._update(); + }, + contains: function(name) { + return !!~this._list.indexOf(name); } - return this; - } - }); -}); -define("graphic/svg", [], function(require, exports, module) { - var doc = document; - var id = 0; - var svg = { - createNode: function(name) { - var node = doc.createElementNS(svg.ns, name); - node.id = "kity_" + name + "_" + id++; - return node; - }, - defaults: { - stroke: "none", - fill: "none" - }, - xlink: "http://www.w3.org/1999/xlink", - ns: "http://www.w3.org/2000/svg" - }; - return svg; -}); -define("graphic/sweep", [ "graphic/point", "core/class", "graphic/path", "core/utils", "graphic/shape", "graphic/svg", "graphic/geometry" ], function(require, exports, module) { - var Point = require("graphic/point"); - return require("core/class").createClass("Sweep", { - base: require("graphic/path"), - constructor: function(sectionArray, angle, angleOffset) { - this.callBase(); - this.sectionArray = sectionArray || []; - this.angle = angle || 0; - this.angleOffset = angleOffset || 0; - this.draw(); - }, - getSectionArray: function() { - return this.sectionArray; - }, - setSectionArray: function(value) { - this.sectionArray = value; - return this.draw(); - }, - getAngle: function() { - return this.angle; - }, - setAngle: function(value) { - this.angle = value; - return this.draw(); - }, - getAngleOffset: function() { - return this.angleOffset; - }, - setAngleOffset: function(value) { - this.angleOffset = value; - return this.draw(); - }, - draw: function() { - var sectionArray = this.sectionArray, i; - for (i = 0; i < sectionArray.length; i += 2) { - this.drawSection(sectionArray[i], sectionArray[i + 1]); - } - return this; - }, - drawSection: function(from, to) { - var angleLength = this.angle && (this.angle % 360 ? this.angle % 360 : 360), angleStart = this.angleOffset, angleHalf = angleStart + angleLength / 2, angleEnd = angleStart + angleLength, drawer = this.getDrawer(); - drawer.redraw(); - if (angleLength === 0) { - drawer.done(); - return; - } - drawer.moveTo(Point.fromPolar(from, angleStart)); - drawer.lineTo(Point.fromPolar(to, angleStart)); - if (to) { - drawer.carcTo(to, 0, 1, Point.fromPolar(to, angleHalf)); - drawer.carcTo(to, 0, 1, Point.fromPolar(to, angleEnd)); - } - drawer.lineTo(Point.fromPolar(from, angleEnd)); - if (from) { - drawer.carcTo(from, 0, 1, Point.fromPolar(from, angleHalf)); - drawer.carcTo(from, 0, 1, Point.fromPolar(from, angleStart)); + }); + function getClassList(node) { + if (!node.classList) { + node.classList = new ClassList(node); } - drawer.close(); - drawer.done(); - } - }); -}); -define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "graphic/shapecontainer", "graphic/container", "core/utils", "graphic/svg" ], function(require, exports, module) { - var TextContent = require("graphic/textcontent"); - var ShapeContainer = require("graphic/shapecontainer"); - var svg = require("graphic/svg"); - var utils = require("core/utils"); - var offsetHash = {}; - function getTextBoundOffset(text) { - var font = text._cachedFontHash; - if (offsetHash[font]) { - return offsetHash[font]; + return node.classList; } - var textContent = text.getContent(); - text.setContent("test"); - var bbox = text.getBoundaryBox(), y = text.getY() + +text.node.getAttribute("dy"); - var topOffset = y - bbox.y, bottomOffset = topOffset - bbox.height; - text.setContent(textContent); - return offsetHash[font] = { - top: topOffset, - bottom: bottomOffset, - middle: (topOffset + bottomOffset) / 2 + return _p.r(11).createClass("Styled", { + addClass: function(name) { + getClassList(this.node).add(name); + return this; + }, + removeClass: function(name) { + getClassList(this.node).remove(name); + return this; + }, + hasClass: function(name) { + return getClassList(this.node).contains(name); + }, + setStyle: function(styles) { + if (arguments.length == 2) { + this.node.style[arguments[0]] = arguments[1]; + return this; + } + for (var name in styles) { + if (styles.hasOwnProperty(name)) { + this.node.style[name] = styles[name]; + } + } + return this; + } + }); + } +}; + +//src/graphic/svg.js +_p[68] = { + value: function(require, exports, module) { + var doc = document; + var id = 0; + var svg = { + createNode: function(name) { + var node = doc.createElementNS(svg.ns, name); + node.id = "kity_" + name + "_" + id++; + return node; + }, + defaults: { + stroke: "none", + fill: "none" + }, + xlink: "http://www.w3.org/1999/xlink", + ns: "http://www.w3.org/2000/svg" }; + return svg; } - return require("core/class").createClass("Text", { - base: TextContent, - mixins: [ ShapeContainer ], - constructor: function(content) { - this.callBase("text"); - if (content !== undefined) { - this.setContent(content); +}; + +//src/graphic/sweep.js +_p[69] = { + value: function(require, exports, module) { + var Point = _p.r(51); + return _p.r(11).createClass("Sweep", { + base: _p.r(47), + constructor: function(sectionArray, angle, angleOffset) { + this.callBase(); + this.sectionArray = sectionArray || []; + this.angle = angle || 0; + this.angleOffset = angleOffset || 0; + this.draw(); + }, + getSectionArray: function() { + return this.sectionArray; + }, + setSectionArray: function(value) { + this.sectionArray = value; + return this.draw(); + }, + getAngle: function() { + return this.angle; + }, + setAngle: function(value) { + this.angle = value; + return this.draw(); + }, + getAngleOffset: function() { + return this.angleOffset; + }, + setAngleOffset: function(value) { + this.angleOffset = value; + return this.draw(); + }, + draw: function() { + var sectionArray = this.sectionArray, i; + for (i = 0; i < sectionArray.length; i += 2) { + this.drawSection(sectionArray[i], sectionArray[i + 1]); + } + return this; + }, + drawSection: function(from, to) { + var angleLength = this.angle && (this.angle % 360 ? this.angle % 360 : 360), angleStart = this.angleOffset, angleHalf = angleStart + angleLength / 2, angleEnd = angleStart + angleLength, drawer = this.getDrawer(); + drawer.redraw(); + if (angleLength === 0) { + drawer.done(); + return; + } + drawer.moveTo(Point.fromPolar(from, angleStart)); + drawer.lineTo(Point.fromPolar(to, angleStart)); + if (to) { + drawer.carcTo(to, 0, 1, Point.fromPolar(to, angleHalf)); + drawer.carcTo(to, 0, 1, Point.fromPolar(to, angleEnd)); + } + drawer.lineTo(Point.fromPolar(from, angleEnd)); + if (from) { + drawer.carcTo(from, 0, 1, Point.fromPolar(from, angleHalf)); + drawer.carcTo(from, 0, 1, Point.fromPolar(from, angleStart)); + } + drawer.close(); + drawer.done(); } - this._buildFontHash(); - }, - _buildFontHash: function() { - var style = window.getComputedStyle(this.node); - this._cachedFontHash = [ style.fontFamily, style.fontSize, style.fontStretch, style.fontStyle, style.fontVariant, style.fontWeight ].join("-"); - }, - _fontChanged: function(font) { - var last = this._lastFont; - var current = utils.extend({}, last, font); - if (!last) { - last = font; - return true; - } - var changed = last.family != current.family || last.size != current.size || last.style != current.style || last.weight != current.weight; - last = current; - return changed; - }, - setX: function(x) { - this.node.setAttribute("x", x); - return this; - }, - setPosition: function(x, y) { - return this.setX(x).setY(y); - }, - setY: function(y) { - this.node.setAttribute("y", y); - return this; - }, - getX: function() { - return +this.node.getAttribute("x") || 0; - }, - getY: function() { - return +this.node.getAttribute("y") || 0; - }, - setFont: function(font) { - this.callBase(font); - if (this._fontChanged(font)) { + }); + } +}; + +//src/graphic/text.js +_p[70] = { + value: function(require, exports, module) { + var TextContent = _p.r(71); + var ShapeContainer = _p.r(62); + var svg = _p.r(68); + var utils = _p.r(12); + var offsetHash = {}; + function getTextBoundOffset(text) { + var font = text._cachedFontHash; + if (offsetHash[font]) { + return offsetHash[font]; + } + var textContent = text.getContent(); + text.setContent("test"); + var bbox = text.getBoundaryBox(), y = text.getY() + +text.node.getAttribute("dy"); + var topOffset = y - bbox.y, bottomOffset = topOffset - bbox.height; + text.setContent(textContent); + return offsetHash[font] = { + top: topOffset, + bottom: bottomOffset, + middle: (topOffset + bottomOffset) / 2 + }; + } + return _p.r(11).createClass("Text", { + base: TextContent, + mixins: [ ShapeContainer ], + constructor: function(content) { + this.callBase("text"); + if (content !== undefined) { + this.setContent(content); + } this._buildFontHash(); - this.setVerticalAlign(this.getVerticalAlign()); - } - return this; - }, - setTextAnchor: function(anchor) { - this.node.setAttribute("text-anchor", anchor); - return this; - }, - getTextAnchor: function() { - return this.node.getAttribute("text-anchor") || "start"; - }, - // top/bottom/middle/baseline - setVerticalAlign: function(align) { - this.whenPaperReady(function() { - var dy; - switch (align) { - case "top": - dy = getTextBoundOffset(this).top; - break; + }, + _buildFontHash: function() { + var style = window.getComputedStyle(this.node); + this._cachedFontHash = [ style.fontFamily, style.fontSize, style.fontStretch, style.fontStyle, style.fontVariant, style.fontWeight ].join("-"); + }, + _fontChanged: function(font) { + var last = this._lastFont; + var current = utils.extend({}, last, font); + if (!last) { + last = font; + return true; + } + var changed = last.family != current.family || last.size != current.size || last.style != current.style || last.weight != current.weight; + last = current; + return changed; + }, + setX: function(x) { + this.node.setAttribute("x", x); + return this; + }, + setPosition: function(x, y) { + return this.setX(x).setY(y); + }, + setY: function(y) { + this.node.setAttribute("y", y); + return this; + }, + getX: function() { + return +this.node.getAttribute("x") || 0; + }, + getY: function() { + return +this.node.getAttribute("y") || 0; + }, + setFont: function(font) { + this.callBase(font); + if (this._fontChanged(font)) { + this._buildFontHash(); + this.setVerticalAlign(this.getVerticalAlign()); + } + return this; + }, + setTextAnchor: function(anchor) { + this.node.setAttribute("text-anchor", anchor); + return this; + }, + getTextAnchor: function() { + return this.node.getAttribute("text-anchor") || "start"; + }, + // top/bottom/middle/baseline + setVerticalAlign: function(align) { + this.whenPaperReady(function() { + var dy; + switch (align) { + case "top": + dy = getTextBoundOffset(this).top; + break; - case "bottom": - dy = getTextBoundOffset(this).bottom; - break; + case "bottom": + dy = getTextBoundOffset(this).bottom; + break; - case "middle": - dy = getTextBoundOffset(this).middle; - break; + case "middle": + dy = getTextBoundOffset(this).middle; + break; - default: - dy = 0; + default: + dy = 0; + } + this.node.setAttribute("dy", dy); + }); + this.verticalAlign = align; + return this; + }, + getVerticalAlign: function() { + return this.verticalAlign || "baseline"; + }, + setStartOffset: function(offset) { + // only for text path + if (this.shapeNode != this.node) { + this.shapeNode.setAttribute("startOffset", offset * 100 + "%"); } - this.node.setAttribute("dy", dy); - }); - this.verticalAlign = align; - return this; - }, - getVerticalAlign: function() { - return this.verticalAlign || "baseline"; - }, - setStartOffset: function(offset) { - // only for text path - if (this.shapeNode != this.node) { - this.shapeNode.setAttribute("startOffset", offset * 100 + "%"); - } - }, - addSpan: function(span) { - this.addShape(span); - return this; - }, - setPath: function(path) { - var textpath = this.shapeNode; - if (this.shapeNode == this.node) { - // 当前还不是 textpath - textpath = this.shapeNode = svg.createNode("textPath"); - while (this.node.firstChild) { - this.shapeNode.appendChild(this.node.firstChild); - } - this.node.appendChild(textpath); - } - textpath.setAttributeNS(svg.xlink, "xlink:href", "#" + path.node.id); - this.setTextAnchor(this.getTextAnchor()); - return this; - } - }); -}); -define("graphic/textcontent", [ "graphic/shape", "graphic/svg", "core/utils", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box", "core/class" ], function(require, exports, module) { - var Shape = require("graphic/shape"); - return require("core/class").createClass("TextContent", { - base: Shape, - constructor: function(nodeType) { - // call shape constructor - this.callBase(nodeType); - this.shapeNode = this.shapeNode || this.node; - this.shapeNode.setAttribute("text-rendering", "geometricPrecision"); - }, - clearContent: function() { - while (this.shapeNode.firstChild) { - this.shapeNode.removeChild(this.shapeNode.firstChild); + }, + addSpan: function(span) { + this.addShape(span); + return this; + }, + setPath: function(path) { + var textpath = this.shapeNode; + if (this.shapeNode == this.node) { + // 当前还不是 textpath + textpath = this.shapeNode = svg.createNode("textPath"); + while (this.node.firstChild) { + this.shapeNode.appendChild(this.node.firstChild); + } + this.node.appendChild(textpath); + } + textpath.setAttributeNS(svg.xlink, "xlink:href", "#" + path.node.id); + this.setTextAnchor(this.getTextAnchor()); + return this; } - return this; - }, - setContent: function(content) { - this.shapeNode.textContent = content; - return this; - }, - getContent: function() { - return this.shapeNode.textContent; - }, - appendContent: function(content) { - this.shapeNode.textContent += content; - return this; - }, - setSize: function(value) { - return this.setFontSize(value); - }, - setFontSize: function(value) { - return this.setFont({ - size: value - }); - }, - setFontFamily: function(value) { - return this.setFont({ - family: value - }); - }, - setFontBold: function(bold) { - return this.setFont({ - weight: bold ? "bold" : "normal" - }); - }, - setFontItalic: function(italic) { - return this.setFont({ - style: italic ? "italic" : "normal" - }); - }, - setFont: function(font) { - var node = this.node; - [ "family", "size", "weight", "style" ].forEach(function(section) { - if (font[section] === null) { - node.removeAttribute("font-" + section); - } else if (font[section]) { - node.setAttribute("font-" + section, font[section]); + }); + } +}; + +//src/graphic/textcontent.js +_p[71] = { + value: function(require, exports, module) { + var Shape = _p.r(61); + return _p.r(11).createClass("TextContent", { + base: Shape, + constructor: function(nodeType) { + // call shape constructor + this.callBase(nodeType); + this.shapeNode = this.shapeNode || this.node; + this.shapeNode.setAttribute("text-rendering", "geometricPrecision"); + }, + clearContent: function() { + while (this.shapeNode.firstChild) { + this.shapeNode.removeChild(this.shapeNode.firstChild); } - }); - return this; - }, - getExtentOfChar: function(index) { - return this.node.getExtentOfChar(index); - }, - getRotationOfChar: function(index) { - return this.node.getRotationOfChar(index); - }, - getCharNumAtPosition: function(x, y) { - return this.node.getCharNumAtPosition(this.node.viewportElement.createSVGPoint(x, y)); - } - }); -}); -define("graphic/textspan", [ "graphic/textcontent", "graphic/shape", "core/class", "graphic/styled" ], function(require, exports, module) { - var TextContent = require("graphic/textcontent"); - var Styled = require("graphic/styled"); - return require("core/class").createClass("TextSpan", { - base: TextContent, - mixins: [ Styled ], - constructor: function(content) { - this.callBase("tspan"); - this.setContent(content); - } - }); -}); + return this; + }, + setContent: function(content) { + this.shapeNode.textContent = content; + return this; + }, + getContent: function() { + return this.shapeNode.textContent; + }, + appendContent: function(content) { + this.shapeNode.textContent += content; + return this; + }, + setSize: function(value) { + return this.setFontSize(value); + }, + setFontSize: function(value) { + return this.setFont({ + size: value + }); + }, + setFontFamily: function(value) { + return this.setFont({ + family: value + }); + }, + setFontBold: function(bold) { + return this.setFont({ + weight: bold ? "bold" : "normal" + }); + }, + setFontItalic: function(italic) { + return this.setFont({ + style: italic ? "italic" : "normal" + }); + }, + setFont: function(font) { + var node = this.node; + [ "family", "size", "weight", "style" ].forEach(function(section) { + if (font[section] === null) { + node.removeAttribute("font-" + section); + } else if (font[section]) { + node.setAttribute("font-" + section, font[section]); + } + }); + return this; + }, + getExtentOfChar: function(index) { + return this.node.getExtentOfChar(index); + }, + getRotationOfChar: function(index) { + return this.node.getRotationOfChar(index); + }, + getCharNumAtPosition: function(x, y) { + return this.node.getCharNumAtPosition(this.node.viewportElement.createSVGPoint(x, y)); + } + }); + } +}; + +//src/graphic/textspan.js +_p[72] = { + value: function(require, exports, module) { + var TextContent = _p.r(71); + var Styled = _p.r(67); + return _p.r(11).createClass("TextSpan", { + base: TextContent, + mixins: [ Styled ], + constructor: function(content) { + this.callBase("tspan"); + this.setContent(content); + } + }); + } +}; + +//src/graphic/use.js /* * USE 功能 */ -define("graphic/use", [ "graphic/svg", "core/class", "graphic/shape", "core/utils", "graphic/eventhandler", "graphic/styled", "graphic/data", "graphic/matrix", "graphic/pen", "graphic/box" ], function(require, exports, module) { - var Svg = require("graphic/svg"); - var Class = require("core/class"); - var Use = Class.createClass("Use", { - base: require("graphic/shape"), - constructor: function(shape) { - this.callBase("use"); - this.ref(shape); - }, - ref: function(shape) { - if (!shape) { - this.node.removeAttributeNS(Svg.xlink, "xlink:href"); +_p[73] = { + value: function(require, exports, module) { + var Svg = _p.r(68); + var Class = _p.r(11); + var Use = Class.createClass("Use", { + base: _p.r(61), + constructor: function(shape) { + this.callBase("use"); + this.ref(shape); + }, + ref: function(shape) { + if (!shape) { + this.node.removeAttributeNS(Svg.xlink, "xlink:href"); + return this; + } + var shapeId = shape.getId(); + if (shapeId) { + this.node.setAttributeNS(Svg.xlink, "xlink:href", "#" + shapeId); + } + // by techird + // 作为 Use 的图形,如果没有 fill 和 stroke,移除默认的 'none' 值,用于 Use 覆盖 + if (shape.node.getAttribute("fill") === "none") { + shape.node.removeAttribute("fill"); + } + if (shape.node.getAttribute("stroke") === "none") { + shape.node.removeAttribute("stroke"); + } return this; } - var shapeId = shape.getId(); - if (shapeId) { - this.node.setAttributeNS(Svg.xlink, "xlink:href", "#" + shapeId); - } - // by techird - // 作为 Use 的图形,如果没有 fill 和 stroke,移除默认的 'none' 值,用于 Use 覆盖 - if (shape.node.getAttribute("fill") === "none") { - shape.node.removeAttribute("fill"); + }); + var Shape = _p.r(61); + Class.extendClass(Shape, { + // fast-use + use: function() { + return new Use(this); } - if (shape.node.getAttribute("stroke") === "none") { - shape.node.removeAttribute("stroke"); + }); + return Use; + } +}; + +//src/graphic/vector.js +_p[74] = { + value: function(require, exports, module) { + var Point = _p.r(51); + var Matrix = _p.r(44); + var Vector = _p.r(11).createClass("Vector", { + base: Point, + constructor: function(x, y) { + this.callBase(x, y); + }, + square: function() { + return this.x * this.x + this.y * this.y; + }, + length: function() { + return Math.sqrt(this.square()); + }, + add: function(q) { + return new Vector(this.x + q.x, this.y + q.y); + }, + minus: function(q) { + return new Vector(this.x - q.x, this.y - q.y); + }, + dot: function(q) { + return this.x * q.x + this.y * q.y; + }, + project: function(q) { + return q.multipy(this.dot(q) / q.square()); + }, + normalize: function(length) { + if (length === undefined) { + length = 1; + } + return this.multipy(length / this.length()); + }, + multipy: function(scale) { + return new Vector(this.x * scale, this.y * scale); + }, + rotate: function(angle, unit) { + if (unit == "rad") { + angle = angle / Math.PI * 180; + } + var p = new Matrix().rotate(angle).transformPoint(this); + return new Vector(p.x, p.y); + }, + vertical: function() { + return new Vector(this.y, -this.x); + }, + reverse: function() { + return this.multipy(-1); + }, + getAngle: function() { + var length = this.length(); + if (length === 0) return 0; + var rad = Math.acos(this.x / length); + var sign = this.y > 0 ? 1 : -1; + return sign * 180 * rad / Math.PI; } - return this; - } - }); - var Shape = require("graphic/shape"); - Class.extendClass(Shape, { - // fast-use - use: function() { - return new Use(this); - } - }); - return Use; -}); -define("graphic/vector", [ "graphic/point", "core/class", "graphic/matrix", "core/utils", "graphic/box" ], function(require, exports, module) { - var Point = require("graphic/point"); - var Matrix = require("graphic/matrix"); - var Vector = require("core/class").createClass("Vector", { - base: Point, - constructor: function(x, y) { - this.callBase(x, y); - }, - square: function() { - return this.x * this.x + this.y * this.y; - }, - length: function() { - return Math.sqrt(this.square()); - }, - add: function(q) { - return new Vector(this.x + q.x, this.y + q.y); - }, - minus: function(q) { - return new Vector(this.x - q.x, this.y - q.y); - }, - dot: function(q) { - return this.x * q.x + this.y * q.y; - }, - project: function(q) { - return q.multipy(this.dot(q) / q.square()); - }, - normalize: function(length) { - if (length === undefined) { - length = 1; + }); + Vector.fromPoints = function(p1, p2) { + return new Vector(p2.x - p1.x, p2.y - p1.y); + }; + _p.r(11).extendClass(Point, { + asVector: function() { + return new Vector(this.x, this.y); } - return this.multipy(length / this.length()); - }, - multipy: function(scale) { - return new Vector(this.x * scale, this.y * scale); - }, - rotate: function(angle, unit) { - if (unit == "rad") { - angle = angle / Math.PI * 180; + }); + return Vector; + } +}; + +//src/graphic/view.js +_p[75] = { + value: function(require, exports, module) { + var ShapeContainer = _p.r(62); + var ViewBox = _p.r(76); + return _p.r(11).createClass("View", { + mixins: [ ShapeContainer, ViewBox ], + base: _p.r(75), + constructor: function() { + this.callBase("view"); } - var p = new Matrix().rotate(angle).transformPoint(this); - return new Vector(p.x, p.y); - }, - vertical: function() { - return new Vector(this.y, -this.x); - }, - reverse: function() { - return this.multipy(-1); - }, - getAngle: function() { - var length = this.length(); - if (length === 0) return 0; - var rad = Math.acos(this.x / length); - var sign = this.y > 0 ? 1 : -1; - return sign * 180 * rad / Math.PI; - } - }); - Vector.fromPoints = function(p1, p2) { - return new Vector(p2.x - p1.x, p2.y - p1.y); - }; - require("core/class").extendClass(Point, { - asVector: function() { - return new Vector(this.x, this.y); - } - }); - return Vector; -}); -define("graphic/view", [ "graphic/shapecontainer", "graphic/container", "core/utils", "core/class", "graphic/shape", "graphic/viewbox", "graphic/view" ], function(require, exports, module) { - var ShapeContainer = require("graphic/shapecontainer"); - var ViewBox = require("graphic/viewbox"); - return require("core/class").createClass("View", { - mixins: [ ShapeContainer, ViewBox ], - base: require("graphic/view"), - constructor: function() { - this.callBase("view"); - } - }); -}); -define("graphic/viewbox", [ "core/class" ], function(require, exports, module) { - return require("core/class").createClass("ViewBox", { - getViewBox: function() { - var attr = this.node.getAttribute("viewBox"); - if (attr === null) { - // firefox: - // 1. viewBox 没有设置过的时候获得的是 null - // 2. svg 标签没有指定绝对大小的时候 clientWidth 和 clientHeigt 为 0,需要在父容器上查找 - // TODO: 第 2 条取得的不准确(假如有 padding 之类的) - return { - x: 0, - y: 0, - width: this.node.clientWidth || this.node.parentNode.clientWidth, - height: this.node.clientHeight || this.node.parentNode.clientHeight - }; - } else { - attr = attr.split(" "); - return { - x: +attr[0], - y: +attr[1], - width: +attr[2], - height: +attr[3] - }; + }); + } +}; + +//src/graphic/viewbox.js +_p[76] = { + value: function(require, exports, module) { + return _p.r(11).createClass("ViewBox", { + getViewBox: function() { + var attr = this.node.getAttribute("viewBox"); + if (attr === null) { + // firefox: + // 1. viewBox 没有设置过的时候获得的是 null + // 2. svg 标签没有指定绝对大小的时候 clientWidth 和 clientHeigt 为 0,需要在父容器上查找 + // TODO: 第 2 条取得的不准确(假如有 padding 之类的) + return { + x: 0, + y: 0, + width: this.node.clientWidth || this.node.parentNode.clientWidth, + height: this.node.clientHeight || this.node.parentNode.clientHeight + }; + } else { + attr = attr.split(" "); + return { + x: +attr[0], + y: +attr[1], + width: +attr[2], + height: +attr[3] + }; + } + }, + setViewBox: function(x, y, width, height) { + this.node.setAttribute("viewBox", [ x, y, width, height ].join(" ")); + return this; } - }, - setViewBox: function(x, y, width, height) { - this.node.setAttribute("viewBox", [ x, y, width, height ].join(" ")); - return this; - } - }); -}); + }); + } +}; + +//src/kity.js /** * @fileOverview kity 暴露的方法或对象 */ -define("kity", [ "core/utils", "core/class", "core/browser", "graphic/box", "graphic/bezier", "graphic/pointcontainer", "graphic/path", "graphic/bezierpoint", "graphic/shapepoint", "graphic/vector", "graphic/circle", "graphic/ellipse", "graphic/clip", "graphic/shape", "graphic/shapecontainer", "graphic/color", "graphic/standardcolor", "graphic/container", "graphic/curve", "graphic/point", "graphic/gradientbrush", "graphic/svg", "graphic/defbrush", "graphic/group", "graphic/hyperlink", "graphic/image", "graphic/line", "graphic/lineargradientbrush", "graphic/mask", "graphic/matrix", "graphic/marker", "graphic/resource", "graphic/viewbox", "graphic/palette", "graphic/paper", "graphic/eventhandler", "graphic/styled", "graphic/geometry", "graphic/patternbrush", "graphic/pen", "graphic/polygon", "graphic/poly", "graphic/polyline", "graphic/pie", "graphic/sweep", "graphic/radialgradientbrush", "graphic/rect", "graphic/regularpolygon", "graphic/ring", "graphic/data", "graphic/star", "graphic/text", "graphic/textcontent", "graphic/textspan", "graphic/use", "animate/animator", "animate/timeline", "animate/easing", "animate/opacityanimator", "animate/rotateanimator", "animate/scaleanimator", "animate/frame", "animate/translateanimator", "animate/pathanimator", "animate/motionanimator", "filter/filter", "filter/effectcontainer", "filter/gaussianblurfilter", "filter/effect/gaussianblureffect", "filter/projectionfilter", "filter/effect/effect", "filter/effect/colormatrixeffect", "filter/effect/compositeeffect", "filter/effect/offseteffect", "filter/effect/convolvematrixeffect" ], function(require, exports, module) { - var kity = {}, utils = require("core/utils"); - kity.version = "2.0.0"; - utils.extend(kity, { - // core - createClass: require("core/class").createClass, - extendClass: require("core/class").extendClass, - Utils: utils, - Browser: require("core/browser"), - // shape - Box: require("graphic/box"), - Bezier: require("graphic/bezier"), - BezierPoint: require("graphic/bezierpoint"), - Circle: require("graphic/circle"), - Clip: require("graphic/clip"), - Color: require("graphic/color"), - Container: require("graphic/container"), - Curve: require("graphic/curve"), - Ellipse: require("graphic/ellipse"), - GradientBrush: require("graphic/gradientbrush"), - Group: require("graphic/group"), - HyperLink: require("graphic/hyperlink"), - Image: require("graphic/image"), - Line: require("graphic/line"), - LinearGradientBrush: require("graphic/lineargradientbrush"), - Mask: require("graphic/mask"), - Matrix: require("graphic/matrix"), - Marker: require("graphic/marker"), - Palette: require("graphic/palette"), - Paper: require("graphic/paper"), - Path: require("graphic/path"), - PatternBrush: require("graphic/patternbrush"), - Pen: require("graphic/pen"), - Point: require("graphic/point"), - PointContainer: require("graphic/pointcontainer"), - Polygon: require("graphic/polygon"), - Polyline: require("graphic/polyline"), - Pie: require("graphic/pie"), - RadialGradientBrush: require("graphic/radialgradientbrush"), - Rect: require("graphic/rect"), - RegularPolygon: require("graphic/regularpolygon"), - Ring: require("graphic/ring"), - Shape: require("graphic/shape"), - ShapePoint: require("graphic/shapepoint"), - ShapeContainer: require("graphic/shapecontainer"), - Sweep: require("graphic/sweep"), - Star: require("graphic/star"), - Text: require("graphic/text"), - TextSpan: require("graphic/textspan"), - Use: require("graphic/use"), - Vector: require("graphic/vector"), - g: require("graphic/geometry"), - // animate - Animator: require("animate/animator"), - Easing: require("animate/easing"), - OpacityAnimator: require("animate/opacityanimator"), - RotateAnimator: require("animate/rotateanimator"), - ScaleAnimator: require("animate/scaleanimator"), - Timeline: require("animate/timeline"), - TranslateAnimator: require("animate/translateanimator"), - PathAnimator: require("animate/pathanimator"), - MotionAnimator: require("animate/motionanimator"), - requestFrame: require("animate/frame").requestFrame, - releaseFrame: require("animate/frame").releaseFrame, - // filter - Filter: require("filter/filter"), - GaussianblurFilter: require("filter/gaussianblurfilter"), - ProjectionFilter: require("filter/projectionfilter"), - // effect - ColorMatrixEffect: require("filter/effect/colormatrixeffect"), - CompositeEffect: require("filter/effect/compositeeffect"), - ConvolveMatrixEffect: require("filter/effect/convolvematrixeffect"), - Effect: require("filter/effect/effect"), - GaussianblurEffect: require("filter/effect/gaussianblureffect"), - OffsetEffect: require("filter/effect/offseteffect") - }); - return window.kity = kity; -}); +_p[77] = { + value: function(require, exports, module) { + var kity = {}, utils = _p.r(12); + kity.version = "2.0.0"; + utils.extend(kity, { + // core + createClass: _p.r(11).createClass, + extendClass: _p.r(11).extendClass, + Utils: utils, + Browser: _p.r(10), + // shape + Box: _p.r(25), + Bezier: _p.r(23), + BezierPoint: _p.r(24), + Circle: _p.r(26), + Clip: _p.r(27), + Color: _p.r(28), + Container: _p.r(29), + Curve: _p.r(30), + Ellipse: _p.r(33), + GradientBrush: _p.r(36), + Group: _p.r(37), + HyperLink: _p.r(38), + Image: _p.r(39), + Line: _p.r(40), + LinearGradientBrush: _p.r(41), + Mask: _p.r(43), + Matrix: _p.r(44), + Marker: _p.r(42), + Palette: _p.r(45), + Paper: _p.r(46), + Path: _p.r(47), + PatternBrush: _p.r(48), + Pen: _p.r(49), + Point: _p.r(51), + PointContainer: _p.r(52), + Polygon: _p.r(54), + Polyline: _p.r(55), + Pie: _p.r(50), + RadialGradientBrush: _p.r(56), + Rect: _p.r(57), + RegularPolygon: _p.r(58), + Ring: _p.r(60), + Shape: _p.r(61), + ShapePoint: _p.r(64), + ShapeContainer: _p.r(62), + Sweep: _p.r(69), + Star: _p.r(66), + Text: _p.r(70), + TextSpan: _p.r(72), + Use: _p.r(73), + Vector: _p.r(74), + g: _p.r(35), + // animate + Animator: _p.r(0), + Easing: _p.r(1), + OpacityAnimator: _p.r(4), + RotateAnimator: _p.r(6), + ScaleAnimator: _p.r(7), + Timeline: _p.r(8), + TranslateAnimator: _p.r(9), + PathAnimator: _p.r(5), + MotionAnimator: _p.r(3), + requestFrame: _p.r(2).requestFrame, + releaseFrame: _p.r(2).releaseFrame, + // filter + Filter: _p.r(20), + GaussianblurFilter: _p.r(21), + ProjectionFilter: _p.r(22), + // effect + ColorMatrixEffect: _p.r(13), + CompositeEffect: _p.r(14), + ConvolveMatrixEffect: _p.r(15), + Effect: _p.r(16), + GaussianblurEffect: _p.r(17), + OffsetEffect: _p.r(18) + }); + return window.kity = kity; + } +}; + +var moduleMapping = { + kity: 77 +}; +function use(name) { + _p.r([ moduleMapping[name] ]); +} /* global use, inc: true */ /** * 模块暴露 */ - -(function() { - - try { - inc.use('kity'); - } catch (e) { - use('kity'); - } - -})();})(); +use('kity'); +})(); \ No newline at end of file diff --git a/dist/kity.min.js b/dist/kity.min.js index 5c5b24e..5f86467 100644 --- a/dist/kity.min.js +++ b/dist/kity.min.js @@ -1,12 +1,12 @@ /*! * ==================================================== - * kity - v2.0.0 - 2014-07-30 + * kity - v2.0.0 - 2014-08-04 * https://github.com/fex-team/kity * GitHub: https://github.com/fex-team/kity.git * Copyright (c) 2014 Baidu FEX; Licensed BSD * ==================================================== */ -!function(){function define(a,b,c){if(_modules[a]={exports:{},value:null,factory:null},2===arguments.length&&(c=b),"[object Object]"===_modules.toString.call(c))_modules[a].value=c;else{if("function"!=typeof c)throw new Error("define函数未定义的行为");_modules[a].factory=c}}function require(a){var b=_modules[a],c=null;return b?b.value?b.value:(c=b.factory.call(null,require,b.exports,b),c&&(b.exports=c),b.value=b.exports,b.value):null}function use(a){return require(a)}var _modules={};define("animate/animator",["animate/timeline","graphic/eventhandler","animate/frame","core/utils","core/class","animate/easing","graphic/shape","graphic/svg","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){function b(a){var b=parseFloat(a,10);return/ms/.test(a)?b:/s/.test(a)?1e3*b:/min/.test(a)?60*b*1e3:b}var c=a("animate/timeline"),d=a("animate/easing"),e=a("core/class").createClass("Animator",{constructor:function(a,b,c){if(1==arguments.length){var d=arguments[0];this.beginValue=d.beginValue,this.finishValue=d.finishValue,this.setter=d.setter}else this.beginValue=a,this.finishValue=b,this.setter=c},start:function(a,c,d,e,f){2===arguments.length&&"object"==typeof c&&(d=c.easing,e=c.delay,f=c.callback,c=c.duration),4===arguments.length&&"function"==typeof e&&(f=e,e=0);var g=this.create(a,c,d,f);return e=b(e),e>0?setTimeout(function(){g.play()},e):g.play(),g},create:function(a,f,g,h){var i;return f=f&&b(f)||e.DEFAULT_DURATION,g=g||e.DEFAULT_EASING,"string"==typeof g&&(g=d[g]),i=new c(this,a,f,g),"function"==typeof h&&i.on("finish",h),i},reverse:function(){return new e(this.finishValue,this.beginValue,this.setter)}});e.DEFAULT_DURATION=300,e.DEFAULT_EASING="linear";var f=a("graphic/shape");return a("core/class").extendClass(f,{animate:function(a,b,c,d,e){function f(){g.shift(),g.length&&setTimeout(g[0].t.play.bind(g[0].t),g[0].d)}var g=this._KityAnimateQueue=this._KityAnimateQueue||[],h=a.create(this,b,c,e);return h.on("finish",f),g.push({t:h,d:d}),1==g.length&&setTimeout(h.play.bind(h),d),this},timeline:function(){return this._KityAnimateQueue[0].t},stop:function(){var a=this._KityAnimateQueue;if(a)for(;a.length;)a.shift().t.stop();return this}}),e}),define("animate/easing",[],function(){var a={linear:function(a,b,c,d){return c*(a/d)+b},swing:function(b,c,d,e){return a.easeOutQuad(b,c,d,e)},ease:function(b,c,d,e){return a.easeInOutCubic(b,c,d,e)},easeInQuad:function(a,b,c,d){return c*(a/=d)*a+b},easeOutQuad:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOutQuad:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},easeInCubic:function(a,b,c,d){return c*(a/=d)*a*a+b},easeOutCubic:function(a,b,c,d){return c*((a=a/d-1)*a*a+1)+b},easeInOutCubic:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a+b:c/2*((a-=2)*a*a+2)+b},easeInQuart:function(a,b,c,d){return c*(a/=d)*a*a*a+b},easeOutQuart:function(a,b,c,d){return-c*((a=a/d-1)*a*a*a-1)+b},easeInOutQuart:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a+b:-c/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(a,b,c,d){return c*(a/=d)*a*a*a*a+b},easeOutQuint:function(a,b,c,d){return c*((a=a/d-1)*a*a*a*a+1)+b},easeInOutQuint:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a*a+b:c/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(a,b,c,d){return-c*Math.cos(a/d*(Math.PI/2))+c+b},easeOutSine:function(a,b,c,d){return c*Math.sin(a/d*(Math.PI/2))+b},easeInOutSine:function(a,b,c,d){return-c/2*(Math.cos(Math.PI*a/d)-1)+b},easeInExpo:function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b},easeOutExpo:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOutExpo:function(a,b,c,d){return 0===a?b:a==d?b+c:(a/=d/2)<1?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(a,b,c,d){return-c*(Math.sqrt(1-(a/=d)*a)-1)+b},easeOutCirc:function(a,b,c,d){return c*Math.sqrt(1-(a=a/d-1)*a)+b},easeInOutCirc:function(a,b,c,d){return(a/=d/2)<1?-c/2*(Math.sqrt(1-a*a)-1)+b:c/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(a,b,c,d){var e=1.70158,f=0,g=c;return 0===a?b:1==(a/=d)?b+c:(f||(f=.3*d),ga?-.5*g*Math.pow(2,10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f)+b:g*Math.pow(2,-10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f)*.5+c+b},easeInBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),c*(a/=d)*a*((e+1)*a-e)+b},easeOutBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),c*((a=a/d-1)*a*((e+1)*a+e)+1)+b},easeInOutBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),(a/=d/2)<1?c/2*a*a*(((e*=1.525)+1)*a-e)+b:c/2*((a-=2)*a*(((e*=1.525)+1)*a+e)+2)+b},easeInBounce:function(b,c,d,e){return d-a.easeOutBounce(e-b,0,d,e)+c},easeOutBounce:function(a,b,c,d){return(a/=d)<1/2.75?7.5625*c*a*a+b:2/2.75>a?c*(7.5625*(a-=1.5/2.75)*a+.75)+b:2.5/2.75>a?c*(7.5625*(a-=2.25/2.75)*a+.9375)+b:c*(7.5625*(a-=2.625/2.75)*a+.984375)+b},easeInOutBounce:function(b,c,d,e){return e/2>b?.5*a.easeInBounce(2*b,0,d,e)+c:.5*a.easeOutBounce(2*b-e,0,d,e)+.5*d+c}};return a}),define("animate/frame",[],function(a,b){function c(a){1===l.push(a)&&(i=j(d))}function d(){var a=l;for(l=[];a.length;)h(a.pop());i=0}function e(a){var b=g(a);return c(b),b}function f(a){var b=l.indexOf(a);~b&&l.splice(b,1),0===l.length&&k(i)}function g(a){var b={index:0,time:+new Date,elapsed:0,action:a,next:function(){c(b)}};return b}function h(a){var b=+new Date,c=b-a.time;c>200&&(c=1e3/60),a.dur=c,a.elapsed+=c,a.time=b,a.action.call(null,a),a.index++}var i,j=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(a){return setTimeout(a,1e3/60)},k=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||window.clearTimeout,l=[];b.requestFrame=e,b.releaseFrame=f}),define("animate/motionanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/geometry","core/utils","graphic/point","graphic/vector","graphic/matrix","graphic/path","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/pen","graphic/box"],function(a){var b=a("animate/animator"),c=a("graphic/geometry"),d=a("graphic/path"),e=a("graphic/shape"),f=a("core/class").createClass("MotionAnimator",{base:b,constructor:function(a,b){var e=this;this.callBase({beginValue:0,finishValue:1,setter:function(a,b){var f=e.motionPath instanceof d?e.motionPath.getPathData():e.motionPath,g=c.pointAtPath(f,b);a.setTranslate(g.x,g.y),this.doRotate&&a.setRotate(g.tan.getAngle())}}),this.updatePath(a),this.doRotate=b,this.motionPath=a}});return a("core/class").extendClass(e,{motion:function(a,b,c,d,e){return this.animate(new f(a),b,c,d,e)}}),f}),define("animate/opacityanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("animate/animator"),c=a("core/class").createClass("OpacityAnimator",{base:b,constructor:function(a){this.callBase({beginValue:function(a){return a.getOpacity()},finishValue:a,setter:function(a,b){a.setOpacity(b)}})}}),d=a("graphic/shape");return a("core/class").extendClass(d,{fxOpacity:function(a,b,d,e,f){return this.animate(new c(a),b,d,e,f)},fadeTo:function(){return this.fxOpacity.apply(this,arguments)},fadeIn:function(){return this.fxOpacity.apply(this,[1].concat([].slice.call(arguments)))},fadeOut:function(){return this.fxOpacity.apply(this,[0].concat([].slice.call(arguments)))}}),c}),define("animate/pathanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/geometry","core/utils","graphic/point","graphic/vector","graphic/matrix","graphic/path","graphic/svg"],function(a){var b=a("animate/animator"),c=a("graphic/geometry"),d=a("core/class").createClass("OpacityAnimator",{base:b,constructor:function(a){this.callBase({beginValue:function(a){return this.beginPath=a.getPathData(),0},finishValue:1,setter:function(b,d){b.setPathData(c.pathTween(this.beginPath,a,d))}})}}),e=a("graphic/path");return a("core/class").extendClass(e,{fxPath:function(a,b,c,e,f){return this.animate(new d(a),b,c,e,f)}}),d}),define("animate/rotateanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("animate/animator"),c=a("core/class").createClass("RotateAnimator",{base:b,constructor:function(a){this.callBase({beginValue:0,finishValue:a,setter:function(a,b,c){var d=c.getDelta();a.rotate(d,ax,ay)}})}}),d=a("graphic/shape");return a("core/class").extendClass(d,{fxRotate:function(a,b,d,e,f){return this.animate(new c(a),b,d,e,f)}}),c}),define("animate/scaleanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("animate/animator"),c=a("core/class").createClass("ScaleAnimator",{base:b,constructor:function(a,b){this.callBase({beginValue:0,finishValue:1,setter:function(c,d,e){var f=e.getDelta(),g=Math.pow(a,f),h=Math.pow(b,f);c.scale(h,g)}})}}),d=a("graphic/shape");return a("core/class").extendClass(d,{fxScale:function(a,b,d,e,f,g){return this.animate(new c(a,b),d,e,f,g)}}),c}),define("animate/timeline",["graphic/eventhandler","core/utils","graphic/shapeevent","core/class","animate/frame"],function(a){function b(a,b,c){return g.paralle(a,b,function(a,b){return a+(b-a)*c})}function c(a,b){return g.paralle(a,b,function(a,b){return b-a})}function d(a,b,c){this.timeline=a,this.target=a.target,this.type=b;for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d])}var e=a("graphic/eventhandler"),f=a("animate/frame"),g=a("core/utils"),h=a("core/class").createClass("Timeline",{mixins:[e],constructor:function(a,b,c,d){this.callMixin(),this.target=b,this.time=0,this.duration=c,this.easing=d,this.animator=a,this.beginValue=a.beginValue,this.finishValue=a.finishValue,this.setter=a.setter,this.status="ready"},nextFrame:function(a){"playing"==this.status&&(this.time+=a.dur,this.setValue(this.getValue()),this.time>=this.duration&&this.timeUp(),a.next())},getPlayTime:function(){return this.rollbacking?this.duration-this.time:this.time},getTimeProportion:function(){return this.getPlayTime()/this.duration},getValueProportion:function(){return this.easing(this.getPlayTime(),0,1,this.duration)},getValue:function(){var a=this.beginValue,c=this.finishValue,d=this.getValueProportion();return b(a,c,d)},setValue:function(a){this.lastValue=this.currentValue,this.currentValue=a,this.setter.call(this.target,this.target,a,this)},getDelta:function(){return this.lastValue=void 0===this.lastValue?this.beginValue:this.lastValue,c(this.lastValue,this.currentValue)},play:function(){var a=this.status;switch(this.status="playing",a){case"ready":g.isFunction(this.beginValue)&&(this.beginValue=this.beginValue.call(this.target,this.target)),g.isFunction(this.finishValue)&&(this.finishValue=this.finishValue.call(this.target,this.target)),this.time=0,this.setValue(this.beginValue),this.frame=f.requestFrame(this.nextFrame.bind(this));break;case"finished":case"stoped":this.time=0,this.frame=f.requestFrame(this.nextFrame.bind(this));break;case"paused":this.frame.next()}return this.fire("play",new d(this,"play",{lastStatus:a})),this},pause:function(){return this.status="paused",this.fire("pause",new d(this,"pause")),f.releaseFrame(this.frame),this},stop:function(){return this.status="stoped",this.setValue(this.finishValue),this.rollbacking=!1,this.fire("stop",new d(this,"stop")),f.releaseFrame(this.frame),this},timeUp:function(){this.repeatOption?(this.time=0,this.rollback?this.rollbacking?(this.decreaseRepeat(),this.rollbacking=!1):(this.rollbacking=!0,this.fire("rollback",new d(this,"rollback"))):this.decreaseRepeat(),this.repeatOption?this.fire("repeat",new d(this,"repeat")):this.finish()):this.finish()},finish:function(){this.setValue(this.finishValue),this.status="finished",this.fire("finish",new d(this,"finish")),f.releaseFrame(this.frame)},decreaseRepeat:function(){this.repeatOption!==!0&&this.repeatOption--},repeat:function(a,b){return this.repeatOption=a,this.rollback=b,this}});return h.requestFrame=f.requestFrame,h.releaseFrame=f.releaseFrame,h}),define("animate/translateanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("animate/animator"),c=a("core/class").createClass("TranslateAnimator",{base:b,constructor:function(a,b){this.callBase({x:0,y:0},{x:a,y:b},function(a,b,c){var d=c.getDelta();a.translate(d.x,d.y)})}}),d=a("graphic/shape");return a("core/class").extendClass(d,{fxTranslate:function(a,b,d,e,f,g){return this.animate(new c(a,b),d,e,f,g)}}),c}),define("core/browser",[],function(){var a=function(){var a,b=navigator.userAgent.toLowerCase(),c=window.opera;a={ie:/(msie\s|trident.*rv:)([\w.]+)/.test(b),opera:!!c&&c.version,webkit:b.indexOf(" applewebkit/")>-1,mac:b.indexOf("macintosh")>-1},a.gecko="Gecko"==navigator.product&&!a.webkit&&!a.opera&&!a.ie;var d=0;if(a.ie&&(d=1*(b.match(/(msie\s|trident.*rv:)([\w.]+)/)[2]||0),a.ie11Compat=11==document.documentMode,a.ie9Compat=9==document.documentMode),a.gecko){var e=b.match(/rv:([\d\.]+)/);e&&(e=e[1].split("."),d=1e4*e[0]+100*(e[1]||0)+1*(e[2]||0))}return/chrome\/(\d+\.\d)/i.test(b)&&(a.chrome=+RegExp.$1),/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(b)&&!/chrome/i.test(b)&&(a.safari=+(RegExp.$1||RegExp.$2)),a.opera&&(d=parseFloat(c.version())),a.webkit&&(d=parseFloat(b.match(/ applewebkit\/(\d+)/)[1])),a.version=d,a.isCompatible=!a.mobile&&(a.ie&&d>=6||a.gecko&&d>=10801||a.opera&&d>=9.5||a.air&&d>=1||a.webkit&&d>=522||!1),a}();return a}),define("core/class",[],function(require,exports){function Class(){}function checkBaseConstructorCall(a,b){var c=a.toString();if(!/this\.callBase/.test(c))throw new Error(b+" : 类构造函数没有调用父类的构造函数!为了安全,请调用父类的构造函数")}function inherit(constructor,BaseClass,classname){var KityClass=eval("(function "+classname+"( __inherit__flag ) {if( __inherit__flag != KITY_INHERIT_FLAG ) {KityClass.__KityConstructor.apply(this, arguments);}this.__KityClassName = KityClass.__KityClassName;})");KityClass.__KityConstructor=constructor,KityClass.prototype=new BaseClass(KITY_INHERIT_FLAG);for(var methodName in BaseClass.prototype)BaseClass.prototype.hasOwnProperty(methodName)&&0!==methodName.indexOf("__Kity")&&(KityClass.prototype[methodName]=BaseClass.prototype[methodName]);return KityClass.prototype.constructor=KityClass,KityClass}function mixin(a,b){if(!1==b instanceof Array)return a;var c,d,e,f=b.length;for(a.__KityMixins={constructor:[]},c=0;f>c;c++){d=b[c].prototype;for(e in d)!1!==d.hasOwnProperty(e)&&0!==e.indexOf("__Kity")&&("constructor"===e?a.__KityMixins.constructor.push(d[e]):a.prototype[e]=a.__KityMixins[e]=d[e])}return a}function extend(a,b){b.__KityClassName&&(b=b.prototype);for(var c in b)if(b.hasOwnProperty(c)&&c.indexOf("__Kity")&&"constructor"!=c){var d=a.prototype[c]=b[c];d.__KityMethodClass=a,d.__KityMethodName=c}return a}Function.prototype.bind=Function.prototype.bind||function(a){var b=Array.prototype.slice.call(arguments,1);return this.apply(a,b)},exports.Class=Class,Class.__KityClassName="Class",Class.prototype.base=function(a){var b=arguments.callee.caller,c=b.__KityMethodClass.__KityBaseClass.prototype[a];return c.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callBase=function(){var a=arguments.callee.caller,b=a.__KityMethodClass.__KityBaseClass.prototype[a.__KityMethodName];return b.apply(this,arguments)},Class.prototype.mixin=function(a){var b=arguments.callee.caller,c=b.__KityMethodClass.__KityMixins;if(!c)return this;var d=c[a];return d.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callMixin=function(){var a=arguments.callee.caller,b=a.__KityMethodName,c=a.__KityMethodClass.__KityMixins;if(!c)return this;var d=c[b];if("constructor"==b){for(var e=0,f=d.length;f>e;e++)d[e].call(this);return this}return d.apply(this,arguments)},Class.prototype.pipe=function(a){return"function"==typeof a&&a.call(this,this),this},Class.prototype.getType=function(){return this.__KityClassName},Class.prototype.getClass=function(){return this.constructor};var KITY_INHERIT_FLAG="__KITY_INHERIT_FLAG_"+ +new Date;exports.createClass=function(a,b){var c,d,e;return 1===arguments.length&&(b=arguments[0],a="AnonymousClass"),e=b.base||Class,b.hasOwnProperty("constructor")?(c=b.constructor,e!=Class&&checkBaseConstructorCall(c,a)):c=function(){this.callBase.apply(this,arguments),this.callMixin.apply(this,arguments)},d=inherit(c,e,a),d=mixin(d,b.mixins),d.__KityClassName=c.__KityClassName=a,d.__KityBaseClass=c.__KityBaseClass=e,d.__KityMethodName=c.__KityMethodName="constructor",d.__KityMethodClass=c.__KityMethodClass=d,delete b.mixins,delete b.constructor,delete b.base,d=extend(d,b)},exports.extendClass=extend}),define("core/utils",[],function(){var a={each:function(a,b,c){if(null!==a)if(a.length===+a.length){for(var d=0,e=a.length;e>d;d++)if(b.call(c,a[d],d,a)===!1)return!1}else for(var f in a)if(a.hasOwnProperty(f)&&b.call(c,a[f],f,a)===!1)return!1},extend:function(a){for(var b=arguments,c=this.isBoolean(b[b.length-1])?b[b.length-1]:!1,d=this.isBoolean(b[b.length-1])?b.length-1:b.length,e=1;d>e;e++){var f=b[e];for(var g in f)c&&a.hasOwnProperty(g)||(a[g]=f[g])}return a},deepExtend:function(a){for(var b=arguments,c=this.isBoolean(b[b.length-1])?b[b.length-1]:!1,d=this.isBoolean(b[b.length-1])?b.length-1:b.length,e=1;d>e;e++){var f=b[e];for(var g in f)c&&a.hasOwnProperty(g)||(this.isObject(a[g])&&this.isObject(f[g])?this.deepExtend(a[g],f[g],c):a[g]=f[g])}return a},clone:function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},copy:function(a){return"object"!=typeof a?a:"function"==typeof a?null:JSON.parse(JSON.stringify(a))},queryPath:function(a,b){for(var c=a.split("."),d=0,e=b,f=c.length;f>d;){if(!(c[d]in e))return void 0;if(e=e[c[d]],d++,d>=f||void 0===e)return e}},getValue:function(a,b){return void 0!==a?a:b},flatten:function(b){var c,d=[],e=b.length;for(c=0;e>c;c++)b[c]instanceof Array?d=d.concat(a.flatten(b[c])):d.push(b[c]);return d},paralle:function(b,c,d){var e,f,g,h;if(b instanceof Array){for(h=[],f=0;fg;g++)b[5*g+3]=c[g]/255;return b[18]=a.get("a"),this.colorMatrixEffect.set("values",b.join(" ")),this},setOpacity:function(a){var b=this.colorMatrixEffect.get("values").split(" ");return b[18]=a,this.colorMatrixEffect.set("values",b.join(" ")),this},setOffset:function(a,b){this.setOffsetX(a),this.setOffsetY(b)},setOffsetX:function(a){this.offsetEffect.set("dx",a)},setOffsetY:function(a){this.offsetEffect.set("dy",a)},setDeviation:function(a){this.gaussianblurEffect.set("stdDeviation",a)}})}),define("graphic/bezier",["core/class","graphic/pointcontainer","graphic/container","graphic/path","core/utils","graphic/shape","graphic/svg","graphic/geometry"],function(a){return a("core/class").createClass("Bezier",{mixins:[a("graphic/pointcontainer")],base:a("graphic/path"),constructor:function(a){this.callBase(),a=a||[],this.changeable=!0,this.setBezierPoints(a)},getBezierPoints:function(){return this.getPoints()},setBezierPoints:function(a){return this.setPoints(a)},onContainerChanged:function(){this.changeable&&this.update()},update:function(){var a=null,b=this.getBezierPoints();if(!(b.length<2)){a=this.getDrawer(),a.clear();var c=b[0].getVertex(),d=null,e=null;a.moveTo(c.x,c.y);for(var f=1,g=b.length;g>f;f++)c=b[f].getVertex(),e=b[f].getBackward(),d=b[f-1].getForward(),a.bezierTo(d.x,d.y,e.x,e.y,c.x,c.y);return this}}})}),define("graphic/bezierpoint",["graphic/shapepoint","core/class","graphic/point","graphic/vector","graphic/matrix"],function(a){var b=a("graphic/shapepoint"),c=a("graphic/vector"),d=a("core/class").createClass("BezierPoint",{constructor:function(a,c,d){this.vertex=new b(a,c),this.forward=new b(a,c),this.backward=new b(a,c),this.setSmooth(void 0===d||d),this.setSymReflaction(!0)},clone:function(){var a=new d,b=null;return b=this.getVertex(),a.setVertex(b.x,b.y),b=this.getForward(),a.setForward(b.x,b.y),b=this.getBackward(),a.setBackward(b.x,b.y),a.setSmooth(a.isSmooth()),a},setVertex:function(a,b){return this.vertex.setPoint(a,b),this.update(),this},moveTo:function(a,b){var c=this.forward.getPoint(),d=this.backward.getPoint(),e=this.vertex.getPoint(),f={left:a-e.x,top:b-e.y};this.forward.setPoint(c.x+f.left,c.y+f.top),this.backward.setPoint(d.x+f.left,d.y+f.top),this.vertex.setPoint(a,b),this.update()},setForward:function(a,b){return this.forward.setPoint(a,b),this.smooth&&this.updateAnother(this.forward,this.backward),this.update(),this},setBackward:function(a,b){return this.backward.setPoint(a,b),this.smooth&&this.updateAnother(this.backward,this.forward),this.update(),this},setSymReflaction:function(a){this.symReflaction=a},isSymReflaction:function(){return this.symReflaction},updateAnother:function(a,b){var d=this.getVertex(),e=c.fromPoints(a.getPoint(),d),f=c.fromPoints(d,b.getPoint());f=e.normalize(this.isSymReflaction()?e.length():f.length()),b.setPoint(d.x+f.x,d.y+f.y)},setSmooth:function(a){return this.smooth=!!a,this},getVertex:function(){return this.vertex.getPoint()},getForward:function(){return this.forward.getPoint()},getBackward:function(){return this.backward.getPoint()},isSmooth:function(){return this.smooth},update:function(){return this.container?void(this.container.update&&this.container.update(this)):this}});return d}),define("graphic/box",["core/class"],function(a){var b=a("core/class").createClass("Box",{constructor:function(a,b,c,d){var e=arguments[0];e&&"object"==typeof e&&(a=e.x,b=e.y,c=e.width,d=e.height),0>c&&(a-=c=-c),0>d&&(b-=d=-d),this.x=a||0,this.y=b||0,this.width=c||0,this.height=d||0,this.left=this.x,this.right=this.x+this.width,this.top=this.y,this.bottom=this.y+this.height,this.cx=this.x+this.width/2,this.cy=this.y+this.height/2},getRangeX:function(){return[this.left,this.right]},getRangeY:function(){return[this.top,this.bottom]},merge:function(a){var c=Math.min(this.left,a.left),d=Math.max(this.right,a.right),e=Math.min(this.top,a.top),f=Math.max(this.bottom,a.bottom);return new b(c,e,d-c,f-e)},expand:function(a,c,d,e){if(arguments.length<1)return new b(this);arguments.length<2&&(c=a),arguments.length<3&&(d=a),arguments.length<4&&(e=c);var f=this.left-e,g=this.top-a,h=this.width+c,i=this.height+a;return new b(f,g,h,i)},valueOf:function(){return[this.x,this.y,this.width,this.height]},toString:function(){return this.valueOf().join(" ")}});return b.parse=function(a){return"string"==typeof a?b.parse(a.split(/[\s,]+/).map(parseFloat)):a instanceof Array?new b(a[0],a[1],a[2],a[3]):"x"in a?new b(a):null},b}),define("graphic/circle",["core/class","graphic/ellipse","core/utils","graphic/point","graphic/path"],function(a){return a("core/class").createClass("Circle",{base:a("graphic/ellipse"),constructor:function(a,b,c){this.callBase(a,a,b,c)},getRadius:function(){return this.getRadiusX()},setRadius:function(a){return this.callBase(a,a)}})}),define("graphic/clip",["core/class","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box","graphic/shapecontainer","graphic/container"],function(a){var b=a("core/class"),c=a("graphic/shape"),d=b.createClass("Clip",{base:c,mixins:[a("graphic/shapecontainer")],constructor:function(){this.callBase("clipPath")},clip:function(a){return a.getNode().setAttribute("clip-path","url(#"+this.getId()+")"),this -}});return b.extendClass(c,{clipWith:function(a){return a.clip(this),this}}),d}),define("graphic/color",["core/utils","graphic/standardcolor","core/class"],function(a){var b=a("core/utils"),c=a("graphic/standardcolor"),d={},e=a("core/class").createClass("Color",{constructor:function(){var a=null;"string"==typeof arguments[0]?(a=d.parseToValue(arguments[0]),null===a&&(a={r:0,g:0,b:0,h:0,s:0,l:0,a:1})):(a={r:0|arguments[0],g:0|arguments[1],b:0|arguments[2],a:parseFloat(arguments[3])||1},a=d.overflowFormat(a),a=b.extend(a,d.rgbValueToHslValue(a))),this._color=a},set:function(a,c){if(!e._MAX_VALUE[a])throw new Error("Color set(): Illegal parameter");return"a"!==a&&(c=Math.floor(c)),"h"==a&&(c=(c+360)%360),this._color[a]=Math.max(e._MIN_VALUE[a],Math.min(e._MAX_VALUE[a],c)),-1!=="rgb".indexOf(a)?this._color=b.extend(this._color,d.rgbValueToHslValue(this._color)):-1!=="hsl".indexOf(a)&&(this._color=b.extend(this._color,d.hslValueToRGBValue(this._color))),this},inc:function(a,b){return b=this.get(a)+b,"h"==a?b=(b+360)%360:(b=Math.min(e._MAX_VALUE[a],b),b=Math.max(e._MIN_VALUE[a],b)),this.clone().set(a,b)},dec:function(a,b){return this.inc(a,-b)},clone:function(){return new e(this.toRGBA())},get:function(a){return e._MAX_VALUE[a]?this._color[a]:null},getValues:function(){return b.clone(this._color)},valueOf:function(){return this.getValues()},toRGB:function(){return d.toString(this._color,"rgb")},toRGBA:function(){return d.toString(this._color,"rgba")},toHEX:function(){return d.toString(this._color,"hex")},toHSL:function(){return d.toString(this._color,"hsl")},toHSLA:function(){return d.toString(this._color,"hsla")},toString:function(){return 1===this._color.a?this.toRGB():this.toRGBA()}});return b.extend(e,{_MAX_VALUE:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},_MIN_VALUE:{r:0,g:0,b:0,h:0,s:0,l:0,a:0},R:"r",G:"g",B:"b",H:"h",S:"s",L:"l",A:"a",parse:function(a){var c;return b.isString(a)&&(c=d.parseToValue(a)),b.isObject(a)&&"r"in a&&(c=a),null===c?new e:new e(c.r,c.g,c.b,c.a)},createHSL:function(a,b,c){return e.createHSLA(a,b,c,1)},createHSLA:function(a,b,c,d){var f=null;return b+="%",c+="%",f=["hsla("+a,b,c,d+")"],e.parse(f.join(", "))},createRGB:function(a,b,c){return e.createRGBA(a,b,c,1)},createRGBA:function(a,b,c,d){return new e(a,b,c,d)}}),b.extend(d,{parseToValue:function(a){var b={};if(a=c.EXTEND_STANDARD[a]||c.COLOR_STANDARD[a]||a,/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(a))b=d.hexToValue(a);else if(/^(rgba?)/i.test(a))b=d.rgbaToValue(a);else{if(!/^(hsla?)/i.test(a))return null;b=d.hslaToValue(a)}return d.overflowFormat(b)},hexToValue:function(a){var c={},e=["r","g","b"];return/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(a)?(a=RegExp.$1.split(""),b.each(e,function(b,e){c[b]=d.toNumber(3===a.length?a[e]+a[e]:a[2*e]+a[2*e+1])}),c=b.extend(c,d.rgbValueToHslValue(c)),c.a=1,c):null},rgbaToValue:function(a){var c={},e=!1,f=["r","g","b"];return/^(rgba?)/i.test(a)?(e=4===RegExp.$1.length,a=a.replace(/^rgba?/i,"").replace(/\s+/g,"").replace(/[^0-9,.]/g,"").split(","),b.each(f,function(b,d){c[b]=0|a[d]}),c=b.extend(c,d.rgbValueToHslValue(c)),c.a=e?parseFloat(a[3]):1,c):null},hslaToValue:function(a){var c={},e=!1;return/^(hsla?)/i.test(a)?(e=4===RegExp.$1.length,a=a.replace(/^hsla?/i,"").replace(/\s+/g,"").replace(/[^0-9,.]/g,"").split(","),c.h=0|a[0],c.s=0|a[1],c.l=0|a[2],c=b.extend(c,d.hslValueToRGBValue(c)),c=d.hslValueToRGBValue(c),c.a=e?parseFloat(a[3]):1,c):null},hslValueToRGBValue:function(a){function c(a,b,c){return 0>c?c+=1:c>1&&(c-=1),1>6*c?a+6*(b-a)*c:1>2*c?b:2>3*c?a+(b-a)*(2/3-c)*6:a}var d=null,e=null,f={};return a=b.extend({},a),a.h=a.h/360,a.s=a.s/100,a.l=a.l/100,0===a.s?f.r=f.g=f.b=a.l:(d=a.l<.5?a.l*(1+a.s):a.l+a.s-a.l*a.s,e=2*a.l-d,f.r=c(e,d,a.h+1/3),f.g=c(e,d,a.h),f.b=c(e,d,a.h-1/3)),f.r=Math.min(Math.round(255*f.r),255),f.g=Math.min(Math.round(255*f.g),255),f.b=Math.min(Math.round(255*f.b),255),f},rgbValueToHslValue:function(a){var c=null,d=null,e={};return a=b.extend({},a),a.r=a.r/255,a.g=a.g/255,a.b=a.b/255,c=Math.max(a.r,a.g,a.b),d=Math.min(a.r,a.g,a.b),c===d?e.h=0:c===a.r?e.h=a.g>=a.b?60*(a.g-a.b)/(c-d):60*(a.g-a.b)/(c-d)+360:c===a.g?e.h=60*(a.b-a.r)/(c-d)+120:c===a.b&&(e.h=60*(a.r-a.g)/(c-d)+240),e.l=(c+d)/2,e.s=0===e.l||c===d?0:e.l>0&&e.l<=.5?(c-d)/(c+d):(c-d)/(2-c-d),e.h=Math.round(e.h),e.s=Math.round(100*e.s),e.l=Math.round(100*e.l),e},toString:function(a,c){var e=[];return a=b.extend({},a),-1!==c.indexOf("hsl")&&(a.s+="%",a.l+="%"),"hex"!==c?(b.each(c.split(""),function(b){e.push(a[b])}),(c+"("+e.join(", ")+")").toLowerCase()):(e.push(d.toHexValue(+a.r)),e.push(d.toHexValue(+a.g)),e.push(d.toHexValue(+a.b)),("#"+e.join("")).toLowerCase())},toNumber:function(a){return 0|Number("0x"+a)},toHexValue:function(a){var b=a.toString(16);return 1===b.length?"0"+b:b},overflowFormat:function(a){var c=b.extend({},a),d="rgba";return b.each(d.split(""),function(a){c.hasOwnProperty(a)&&(c[a]=Math.min(e._MAX_VALUE[a],c[a]),c[a]=Math.max(e._MIN_VALUE[a],c[a]))}),c}}),e}),define("graphic/container",["core/class"],function(a){function b(){return this.container.removeItem(this),this}return a("core/class").createClass("Container",{getItems:function(){return this.items||(this.items=[])},getItem:function(a){return this.getItems()[a]},getFirstItem:function(){return this.getItem(0)},getLastItem:function(){return this.getItem(this.getItems().length-1)},indexOf:function(a){return this.getItems().indexOf(a)},eachItem:function(a){var b,c=this.getItems(),d=c.length;for(b=0;d>b;b++)a.call(this,b,c[b]);return this},addItem:function(a,c,d){var e=this.getItems(),f=e.length;return~e.indexOf(a)?this:(c>=0&&f>c||(c=f),e.splice(c,0,a),"object"==typeof a&&(a.container=this,a.remove=b),this.handleAdd(a,c),d||this.onContainerChanged("add",[a]),this)},addItems:function(a){for(var b=0,c=a.length;c>b;b++)this.addItem(a[b],-1,!0);return this.onContainerChanged("add",a),this},setItems:function(a){return this.clear().addItems(a)},appendItem:function(a){return this.addItem(a)},prependItem:function(a){return this.addItem(a,0)},removeItem:function(a,b){if("number"!=typeof a)return this.removeItem(this.indexOf(a));var c=this.getItems(),d=(c.length,c[a]);return void 0===d?this:(c.splice(a,1),d.container&&delete d.container,d.remove&&delete d.remove,this.handleRemove(d,a),b||this.onContainerChanged("remove",[d]),this)},clear:function(){for(var a,b=[];a=this.getFirstItem();)b.push(a),this.removeItem(0,!0);return this.onContainerChanged("remove",b),this},onContainerChanged:function(){},handleAdd:function(){},handleRemove:function(){}})}),define("graphic/curve",["core/utils","core/class","graphic/path","graphic/shape","graphic/svg","graphic/geometry","graphic/pointcontainer","graphic/container"],function(a){var b=a("core/utils"),c={getCurvePanLines:function(a,b){var d=c.getCenterPoints(a),e=c.getPanLine(a.length,d);return c.getMovedPanLines(a,e,b)},getCenterPoints:function(a){for(var b={},c=null,d=0,e=0,f=a.length;f>d;d++)e=d===f-1?0:d+1,c=d+","+e,b[c]={x:(a[d].x+a[e].y)/2,y:(a[d].x+a[e].y)/2};return b},getPanLine:function(a,b){for(var c,d={},e=null,f=0;a>f;f++){var g=null,h=null;c=(f+1)%a,e=c,g=b[f+","+c],f=c,c=(f+1)%a,h=b[f+","+c],d[e]={points:[{x:g.x,y:g.y},{x:h.x,y:h.y}],center:{x:(g.x+h.x)/2,y:(g.y+h.y)/2}},f=(e+a-1)%a}return d},getMovedPanLines:function(a,c,d){var e={};return b.each(a,function(a,f){var g=c[f],h=g.center,i={x:h.x-a.x,y:h.y-a.y},j=e[f]={points:[],center:{x:a.x,y:a.y}};b.each(g.points,function(a){var b={x:a.x-i.x,y:a.y-i.y},c=j.center,e=b.x-c.x,f=b.y-c.y;b.x=c.x+d*e,b.y=c.y+d*f,j.points.push(b)})}),e}};return a("core/class").createClass("Curve",{base:a("graphic/path"),mixins:[a("graphic/pointcontainer")],constructor:function(a,b){this.callBase(),this.setPoints(a||[]),this.closeState=!!b,this.changeable=!0,this.smoothFactor=1,this.update()},onContainerChanged:function(){this.changeable&&this.update()},setSmoothFactor:function(a){return this.smoothFactor=0>a?0:a,this.update(),this},getSmoothFactor:function(){return this.smoothFactor},update:function(){var a=this.getPoints(),b=null,d=this.getDrawer(),e=null,f=null,g=null;if(d.clear(),0===a.length)return this;if(d.moveTo(a[0]),1===a.length)return this;if(2===a.length)return d.lineTo(a[1]),this;b=c.getCurvePanLines(a,this.getSmoothFactor());for(var h=1,i=a.length;i>h;h++)e=b[h].center,f=this.closeState||h!=i-1?b[h].points[0]:b[h].center,g=this.closeState||1!=h?b[h-1].points[1]:b[h-1].center,d.bezierTo(g.x,g.y,f.x,f.y,e.x,e.y);return this.closeState&&(e=b[0].center,f=b[0].points[0],g=b[a.length-1].points[1],d.bezierTo(g.x,g.y,f.x,f.y,e.x,e.y)),this},close:function(){return this.closeState=!0,this.update()},open:function(){return this.closeState=!1,this.update()},isClose:function(){return!!this.closeState}})}),define("graphic/data",["core/class"],function(a){return a("core/class").createClass("Data",{constructor:function(){this._data={}},setData:function(a,b){return this._data[a]=b,this},getData:function(a){return this._data[a]},removeData:function(a){return delete this._data[a],this}})}),define("graphic/defbrush",["core/class","graphic/resource","graphic/svg"],function(a){return a("core/class").createClass("GradientBrush",{base:a("graphic/resource"),constructor:function(a){this.callBase(a)}})}),define("graphic/ellipse",["core/utils","graphic/point","core/class","graphic/path","graphic/shape","graphic/svg","graphic/geometry"],function(a){var b=(a("core/utils"),a("graphic/point"));return a("core/class").createClass("Ellipse",{base:a("graphic/path"),constructor:function(a,b,c,d){this.callBase(),this.rx=a||0,this.ry=b||0,this.cx=c||0,this.cy=d||0,this.update()},update:function(){var a=this.rx,b=this.ry,c=this.cx+a,d=this.cx-a,e=this.cy,f=this.getDrawer();return f.clear(),f.moveTo(c,e),f.arcTo(a,b,0,1,1,d,e),f.arcTo(a,b,0,1,1,c,e),this},getRadius:function(){return{x:this.rx,y:this.ry}},getRadiusX:function(){return this.rx},getRadiusY:function(){return this.ry},getCenter:function(){return new b(this.cx,this.cy)},getCenterX:function(){return this.cx},getCenterY:function(){return this.cy},setRadius:function(a,b){return this.rx=a,this.ry=b,this.update()},setRadiusX:function(a){return this.rx=a,this.update()},setRadiusY:function(a){return this.ry=a,this.update()},setCenter:function(a,c){if(1==arguments.length){var d=b.parse(arguments[0]);a=d.x,c=d.y}return this.cx=a,this.cy=c,this.update()},setCenterX:function(a){return this.cx=a,this.update()},setCenterY:function(a){return this.cy=a,this.update()}})}),define("graphic/eventhandler",["core/utils","graphic/shapeevent","graphic/matrix","graphic/point","core/class"],function(a){function b(a,b,c){return c=!!c,i.isString(a)&&(a=a.match(/\S+/g)),i.each(a,function(a){d.call(this,this.node,a,b,c)},this),this}function c(a,b){var c=null,d=this._EVNET_UID,e=void 0===b;try{c=l[d][a]}catch(g){return}return e||(e=!0,i.each(c,function(a,d){a===b?delete c[d]:e=!1})),e&&(f(this.node,a,k[d][a]),delete l[d][a],delete k[d][a]),this}function d(a,b,c,d){var f=this._EVNET_UID,g=this;k[f]||(k[f]={}),k[f][b]||(k[f][b]=function(a){a=new j(a||window.event),i.each(l[f][b],function(c){var e;return c&&(e=c.call(g,a),d&&g.off(b,c)),e},g)}),l[f]||(l[f]={}),l[f][b]?l[f][b].push(c):(l[f][b]=[c],a&&e(a,b,k[f][b]))}function e(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)}function f(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent(b,c)}function g(a,b,c){var d=new CustomEvent(b,{bubbles:!0,cancelable:!0});d._kityParam=c,a.dispatchEvent(d)}function h(a,b,c){var d=null,e=null;try{if(e=k[a._EVNET_UID][b],!e)return}catch(f){return}d=i.extend({type:b,target:a},c||{}),e.call(a,d)}!function(){function a(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}a.prototype=window.Event.prototype,window.CustomEvent=a}();var i=a("core/utils"),j=a("graphic/shapeevent"),k={},l={},m=0;return a("core/class").createClass("EventHandler",{constructor:function(){this._EVNET_UID=++m},addEventListener:function(a,c){return b.call(this,a,c,!1)},addOnceEventListener:function(a,c){return b.call(this,a,c,!0)},removeEventListener:function(a,b){return c.call(this,a,b)},on:function(){return this.addEventListener.apply(this,arguments)},once:function(){return this.addOnceEventListener.apply(this,arguments)},off:function(){return this.removeEventListener.apply(this,arguments)},fire:function(){return this.trigger.apply(this,arguments)},trigger:function(a,b){return this.node?g(this.node,a,b):h(this,a,b),this}})}),define("graphic/geometry",["core/utils","graphic/point","core/class","graphic/vector","graphic/matrix","graphic/box"],function(a){function b(a){var b,c,d,e,f;for(b=[],c=0;cc;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function e(){var f=Array.prototype.slice.call(arguments,0),g=f.join("␀"),h=e.cache=e.cache||{},i=e.count=e.count||[];return h.hasOwnProperty(g)?(d(i,g),c?c(h[g]):h[g]):(i.length>=1e3&&delete h[i.shift()],i.push(g),h[g]=a.apply(b,f),c?c(h[g]):h[g])}return e}function d(a,b,c,e,f,g,h,i,j,k){var l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q=Math,R=Q.PI,S=Math.abs,T=120*R/180,U=R/180*(+f||0),V=[],W=function(a,b,c){var d=a*Q.cos(c)-b*Q.sin(c),e=a*Q.sin(c)+b*Q.cos(c);return{x:d,y:e}};if(k?(w=k[0],x=k[1],u=k[2],v=k[3]):(l=W(a,b,-U),a=l.x,b=l.y,l=W(i,j,-U),i=l.x,j=l.y,m=Q.cos(R/180*f),n=Q.sin(R/180*f),p=(a-i)/2,q=(b-j)/2,o=p*p/(c*c)+q*q/(e*e),o>1&&(o=Q.sqrt(o),c=o*c,e=o*e),r=c*c,s=e*e,t=(g==h?-1:1)*Q.sqrt(S((r*s-r*q*q-s*p*p)/(r*q*q+s*p*p))),u=t*c*q/e+(a+i)/2,v=t*-e*p/c+(b+j)/2,w=Q.asin(((b-v)/e).toFixed(9)),x=Q.asin(((j-v)/e).toFixed(9)),w=u>a?R-w:w,x=u>i?R-x:x,0>w&&(w=2*R+w),0>x&&(x=2*R+x),h&&w>x&&(w-=2*R),!h&&x>w&&(x-=2*R)),y=x-w,S(y)>T&&(z=x,A=i,B=j,x=w+T*(h&&x>w?1:-1),i=u+c*Q.cos(x),j=v+e*Q.sin(x),V=d(i,j,c,e,f,0,h,A,B,[x,z,u,v])),y=x-w,C=Q.cos(w),D=Q.sin(w),E=Q.cos(x),F=Q.sin(x),G=Q.tan(y/4),H=4/3*c*G,I=4/3*e*G,J=[a,b],K=[a+H*D,b-I*C],L=[i+H*F,j-I*E],M=[i,j],K[0]=2*J[0]-K[0],K[1]=2*J[1]-K[1],k)return[K,L,M].concat(V);for(V=[K,L,M].concat(V).join().split(","),N=[],O=0,P=V.length;P>O;O++)N[O]=O%2?W(V[O-1],V[O],U).y:W(V[O],V[O+1],U).x;return N}function e(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]}function f(a,b){function c(a){return function(b,c){return b+a*(c-b)}}var d=c(b||.5),e=a,f=e[0],g=e[1],h=e[2],i=e[3],j=e[4],k=e[5],l=e[6],m=e[7],n=d(f,h),o=d(g,i),p=d(h,j),q=d(i,k),r=d(j,l),s=d(k,m),t=d(n,p),u=d(o,q),v=d(p,r),w=d(q,s),x=d(t,v),y=d(u,w);return[[f,g,n,o,t,u,x,y],[x,y,v,w,r,s,l,m]]}var g=a("core/utils"),h=a("graphic/point"),i=a("graphic/vector"),j=a("graphic/matrix"),k={},l=/([achlmrqstvz])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?\s*)+)/gi,m=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)\s*,?\s*/gi,n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0};k.pathToString=function(a){return a=a||this,"string"==typeof a?a:a instanceof Array?(a=g.flatten(a),a.join(",").replace(/,?([achlmqrstvxz]),?/gi,"$1")):void 0},k.parsePathString=c(function(a){var b=[];return a.replace(l,function(a,c,d){var e=[],f=c.toLowerCase();if(d.replace(m,function(a,b){b&&e.push(+b)}),"m"==f&&e.length>2&&(b.push([c].concat(e.splice(0,2))),f="l",c="m"==c?"l":"L"),"r"==f)b.push([c].concat(e));else for(;e.length>=n[f]&&(b.push([c].concat(e.splice(0,n[f]))),n[f]););}),b.isUniform=!0,b.toString=k.pathToString,b}),k.pathToAbsolute=c(function(a){var b,c,d,e,f,g,h,i,j=a.isUniform?a:k.parsePathString(k.pathToString(a)),l=[],m=0,n=0,o=0,p=0,q=0;for("M"==j[0][0]&&(m=+j[0][1],n=+j[0][2],o=m,p=n,q++,l[0]=["M",m,n]),d=q,g=j.length;g>d;d++){if(l.push(b=[]),c=j[d],c[0]!=c[0].toUpperCase())switch(b[0]=c[0].toUpperCase(),b[0]){case"A":b[1]=c[1],b[2]=c[2],b[3]=c[3],b[4]=c[4],b[5]=c[5],b[6]=+(c[6]+m),b[7]=+(c[7]+n);break;case"V":b[1]=+c[1]+n;break;case"H":b[1]=+c[1]+m;break;case"M":o=+c[1]+m,p=+c[2]+n;break;default:for(e=1,h=c.length;h>e;e++)b[e]=+c[e]+(e%2?m:n)}else for(f=0,i=c.length;i>f;f++)b[f]=c[f];switch(b[0]){case"Z":m=o,n=p;break;case"H":m=b[1];break;case"V":n=b[1];break;case"M":o=b[b.length-2],p=b[b.length-1];break;default:m=b[b.length-2],n=b[b.length-1]}}return l.isUniform=!0,l.isAbsolute=!0,l.toString=k.pathToString,l}),k.pathToCurve=c(function(a){var b,c,f,g,h,i,j,l,m,n,o,p,q=[];for(a.isAbsolute||(a=k.pathToAbsolute(a)),b=0;bb&&(b=0),Math.pow(b,.5)}var c,d,e,f,g,h,i,j,k,l,m,n=a;return c=-3*n[0]+9*n[2]-9*n[4]+3*n[6],d=6*n[0]-12*n[2]+6*n[4],e=-3*n[0]+3*n[2],f=-3*n[1]+9*n[3]-9*n[5]+3*n[7],g=6*n[1]-12*n[3]+6*n[5],h=-3*n[1]+3*n[3],i=Math.pow(c,2)+Math.pow(f,2),j=2*(c*d+f*g),k=2*(c*e+f*h)+Math.pow(d,2)+Math.pow(g,2),l=2*(d*e+g*h),m=Math.pow(e,2)+Math.pow(h,2),(b(0)+b(1)+4*(b(.125)+b(.375)+b(.625)+b(.875))+2*(b(.25)+b(.5)+b(.75)))/24});var o=c(function(a){var b,c,d,e,f,g,h;for(g=[],h=0,b=0,c=a.length;c>b;b++)d=a[b],"M"!=d[0]?"Z"!=d[0]?(f=k.bezierLength(e.concat(d.slice(1))),g.push([h,h+f]),h+=f,e=d.slice(4)):g.push(null):(e=d.slice(1),g.push(null));return g.totalLength=h,g});k.subPath=function(a,b,c){var d;if(c=c||0,d=b-c,d-=0|d,c-=0|c,b=c+d,b>1)return k.subPath(a,1,c).concat(k.subPath(a,b-1));a.isCurve||(a=k.pathToCurve(a));var e,f,g,h,i,j,l,m,n,p=o(a),q=p.totalLength,r=q*b,s=q*(c||0),t=[];for(e=0,f=a.length;f>e;e++)if("M"!=a[e][0]){if("Z"!=a[e][0])if(g=p[e][0],h=p[e][1],i=h-g,l=j.concat(a[e].slice(1)),s>h)j=l.slice(l.length-2);else{if(s>=g)m=k.subBezier(l,Math.min((r-g)/i,1),(s-g)/i),n=!0,j=m.slice(0,2),t.push(["M"].concat(m.slice(0,2))),t.push(["C"].concat(m.slice(2)));else if(r>=h)t.push(a[e].slice());else{if(!(r>=g))break;m=k.subBezier(l,(r-g)/i),t.push(["C"].concat(m.slice(2))),n=!1}j=l.slice(l.length-2)}}else j=a[e].slice(1),n&&t.push(a[e].slice());return t.isAbsolute=!0,t.isCurve=!0,t.isUniform=!0,t.toString=k.pathToString,t},k.pointAtPath=function(a,b){a.isCurve||(a=k.pathToCurve(a));var c=k.subPath(a,b),d="Z"==c[c.length-1][0]?c[c.length-2]:c[c.length-1];d=d.slice(1);var e=h.parse(d.slice(4)),f=h.parse(d.slice(2,4));return e.tan=i.fromPoints(f,e).normalize(),e},k.pathLength=c(function(a){a.isCurve||(a=k.pathToCurve(a));var b=o(a);return b.totalLength}),k.pathKeyPoints=c(function(a){var b,c,d;for(a.isCurve||(a=k.pathToCurve(a)),d=[],b=0,c=a.length;c>b;b++)"z"!=a[b][0]&&d.push(a[b].slice(a[b].length-2));return d});var p=c(function(a,c){function d(a,b){return a[b||a.i]&&a[b||a.i][0]}function e(a,b){return a[b||a.i]&&a[b||a.i].slice(1)}function f(a,b){var c=e(a,b);return c&&c.slice(-2)}function g(a){return"Z"==d(a)?(a.splice(a.i,1),!0):!1}function h(a){return"M"==d(a)?(a.o.splice(a.o.i,0,["M"].concat(f(a.o,a.o.i-1))),a.i++,a.o.i++,!0):!1}function i(a){for(var b,c=1;!b;)b=f(a,a.length-c++);for(a.o.i=a.i;a.lengthc;c++)for(f.push(g=[a[c][0]]),e=1;ee&&f.setAttribute("stop-opacity",e),this.node.appendChild(f),this}})}),define("graphic/group",["graphic/shapecontainer","graphic/container","core/utils","core/class","graphic/shape","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("graphic/shapecontainer");return a("core/class").createClass("Group",{mixins:[b],base:a("graphic/shape"),constructor:function(){this.callBase("g")}})}),define("graphic/hyperlink",["graphic/shapecontainer","graphic/container","core/utils","core/class","graphic/shape","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("graphic/shapecontainer");return a("core/class").createClass("HyperLink",{mixins:[b],base:a("graphic/shape"),constructor:function(a){this.callBase("a"),this.setHref(a)},setHref:function(a){return this.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a),this},getHref:function(){return this.node.getAttributeNS("xlink:href")},setTarget:function(a){return this.node.setAttribute("target",a),this},getTarget:function(){return this.node.getAttribute("target")}})}),define("graphic/image",["core/class","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){return a("core/class").createClass("Image",{base:a("graphic/shape"),constructor:function(a,b,c,d,e){this.callBase("image"),this.url=a,this.width=b||0,this.height=c||0,this.x=d||0,this.y=e||0,this.update()},update:function(){return this.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",this.url),this.node.setAttribute("x",this.x),this.node.setAttribute("y",this.y),this.node.setAttribute("width",this.width),this.node.setAttribute("height",this.height),this},setUrl:function(a){return this.url=""===a?null:a,this.update()},getUrl:function(){return this.url},setWidth:function(a){return this.width=a,this.update()},getWidth:function(){return this.width},setHeight:function(a){return this.height=a,this.update()},getHeight:function(){return this.height},setX:function(a){return this.x=a,this.update()},getX:function(){return this.x},setY:function(a){return this.y=a,this.update()},getY:function(){return this.y}})}),define("graphic/line",["core/class","graphic/path","core/utils","graphic/shape","graphic/svg","graphic/geometry"],function(a){return a("core/class").createClass("Line",{base:a("graphic/path"),constructor:function(a,b,c,d){this.callBase(),this.point1={x:a||0,y:b||0},this.point2={x:c||0,y:d||0},this.update()},setPoint1:function(a,b){return this.point1.x=a,this.point1.y=b,this.update()},setPoint2:function(a,b){return this.point2.x=a,this.point2.y=b,this.update()},getPoint1:function(){return{x:this.point1.x,y:this.point1.y}},getPoint2:function(){return{x:this.point2.x,y:this.point2.y}},update:function(){var a=this.getDrawer();return a.clear(),a.moveTo(this.point1.x,this.point1.y),a.lineTo(this.point2.x,this.point2.y),this}})}),define("graphic/lineargradientbrush",["graphic/svg","graphic/gradientbrush","graphic/defbrush","graphic/color","core/class"],function(a){var b="LinearGradientBrush",c=(a("graphic/svg"),a("graphic/gradientbrush"));return a("core/class").createClass(b,{base:c,constructor:function(a){this.callBase("linearGradient"),this.setStartPosition(0,0),this.setEndPosition(1,0),"function"==typeof a&&a.call(this,this)},setStartPosition:function(a,b){return this.node.setAttribute("x1",a),this.node.setAttribute("y1",b),this},setEndPosition:function(a,b){return this.node.setAttribute("x2",a),this.node.setAttribute("y2",b),this},getStartPosition:function(){return{x:+this.node.getAttribute("x1"),y:+this.node.getAttribute("y1")}},getEndPosition:function(){return{x:+this.node.getAttribute("x2"),y:+this.node.getAttribute("y2")}}})}),define("graphic/marker",["graphic/point","core/class","graphic/resource","graphic/svg","graphic/shapecontainer","graphic/container","core/utils","graphic/shape","graphic/viewbox","graphic/path","graphic/geometry"],function(a){var b=a("graphic/point"),c=a("core/class").createClass("Marker",{base:a("graphic/resource"),mixins:[a("graphic/shapecontainer"),a("graphic/viewbox")],constructor:function(){this.callBase("marker"),this.setOrient("auto")},setRef:function(a,b){return 1===arguments.length&&(b=a.y,a=a.x),this.node.setAttribute("refX",a),this.node.setAttribute("refY",b),this},getRef:function(){return new b(+this.node.getAttribute("refX"),+this.node.getAttribute("refY"))},setWidth:function(a){return this.node.setAttribute("markerWidth",this.width=a),this},setOrient:function(a){return this.node.setAttribute("orient",this.orient=a),this},getOrient:function(){return this.orient},getWidth:function(){return+this.width},setHeight:function(a){return this.node.setAttribute("markerHeight",this.height=a),this},getHeight:function(){return+this.height}}),d=a("graphic/path");return a("core/class").extendClass(d,{setMarker:function(a,b){return b=b||"end",a?this.node.setAttribute("marker-"+b,a.toString()):this.node.removeAttribute("marker-"+b),this}}),c}),define("graphic/mask",["core/class","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box","graphic/shapecontainer","graphic/container"],function(a){var b=a("core/class"),c=a("graphic/shape"),d=b.createClass("Mask",{base:c,mixins:[a("graphic/shapecontainer")],constructor:function(){this.callBase("mask")},mask:function(a){return a.getNode().setAttribute("mask","url(#"+this.getId()+")"),this}});return b.extendClass(c,{maskWith:function(a){return a.mask(this),this}}),d}),define("graphic/matrix",["core/utils","graphic/box","core/class","graphic/point"],function(a){function b(a,b){return{a:b.a*a.a+b.c*a.b,b:b.b*a.a+b.d*a.b,c:b.a*a.c+b.c*a.d,d:b.b*a.c+b.d*a.d,e:b.a*a.e+b.c*a.f+b.e,f:b.b*a.e+b.d*a.f+b.f}}function c(a){return a*Math.PI/180}var d=a("core/utils"),e=a("graphic/box"),f=/matrix\((.+)\)/i,g=a("graphic/point"),h=a("core/class").createClass("Matrix",{constructor:function(){arguments.length?this.setMatrix.apply(this,arguments):this.setMatrix(1,0,0,1,0,0)},translate:function(a,c){return this.m=b(this.m,{a:1,c:0,e:a,b:0,d:1,f:c}),this},rotate:function(a){var d=c(a),e=Math.sin(d),f=Math.cos(d);return this.m=b(this.m,{a:f,c:-e,e:0,b:e,d:f,f:0}),this},scale:function(a,c){return void 0===c&&(c=a),this.m=b(this.m,{a:a,c:0,e:0,b:0,d:c,f:0}),this},skew:function(a,d){void 0===d&&(d=a);var e=Math.tan(c(a)),f=Math.tan(c(d));return this.m=b(this.m,{a:1,c:e,e:0,b:f,d:1,f:0}),this},inverse:function(){var a,b,c,d,e,f,g,i=this.m,j=i.a,k=i.b,l=i.c,m=i.d,n=i.e,o=i.f;return a=j*m-k*l,b=m/a,c=-k/a,d=-l/a,e=j/a,f=(l*o-n*m)/a,g=(k*n-j*o)/a,new h(b,c,d,e,f,g)},setMatrix:function(a,b,c,e,f,g){return this.m=1===arguments.length?d.clone(arguments[0]):{a:a,b:b,c:c,d:e,e:f,f:g},this},getMatrix:function(){return d.clone(this.m)},getTranslate:function(){var a=this.m;return{x:a.e/a.a,y:a.f/a.d}},mergeMatrix:function(a){return new h(b(this.m,a.m))},merge:function(a){return this.mergeMatrix(a)},toString:function(){return this.valueOf().join(" ")},valueOf:function(){var a=this.m;return[a.a,a.b,a.c,a.d,a.e,a.f]},equals:function(a){var b=this.m,c=a.m;return b.a==c.a&&b.b==c.b&&b.c==c.c&&b.d==c.d&&b.e==c.e&&b.f==c.f},transformPoint:function(){return h.transformPoint.apply(null,[].slice.call(arguments).concat([this.m]))},transformBox:function(a){return h.transformBox(a,this.m)}});return h.parse=function(a){var b,c=parseFloat;if(a instanceof Array)return new h({a:a[0],b:a[1],c:a[2],d:a[3],e:a[4],f:a[5]});if(b=f.exec(a)){var d=b[1].split(",");return 6!=d.length&&(d=b[1].split(" ")),new h({a:c(d[0]),b:c(d[1]),c:c(d[2]),d:c(d[3]),e:c(d[4]),f:c(d[5])})}return new h},h.transformPoint=function(a,b,c){return 2===arguments.length&&(c=b,b=a.y,a=a.x),new g(c.a*a+c.c*b+c.e,c.b*a+c.d*b+c.f)},h.transformBox=function(a,b){for(var c,f,g=Number.MAX_VALUE,i=-Number.MAX_VALUE,j=Number.MAX_VALUE,k=-Number.MAX_VALUE,l=[[a.x,a.y],[a.x+a.width,a.y],[a.x,a.y+a.height],[a.x+a.width,a.y+a.height]],m=[];c=l.pop();)f=h.transformPoint(c[0],c[1],b),m.push(f),g=Math.min(g,f.x),i=Math.max(i,f.x),j=Math.min(j,f.y),k=Math.max(k,f.y);return a=new e({x:g,y:j,width:i-g,height:k-j}),d.extend(a,{closurePoints:m}),a},h.getCTM=function(a,b){var c={a:1,b:0,c:0,d:1,e:0,f:0},d=a.shapeNode||a.node;switch(b=b||"parent"){case"screen":c=d.getScreenCTM();break;case"doc":case"paper":c=d.getCTM();break;case"view":case"top":a.getPaper()&&(c=d.getTransformToElement(a.getPaper().shapeNode));break;case"parent":a.node.parentNode&&(c=d.getTransformToElement(a.node.parentNode));break;default:b.node&&(c=d.getTransformToElement(b.shapeNode||b.node))}return c?new h(c.a,c.b,c.c,c.d,c.e,c.f):new h},h}),define("graphic/palette",["graphic/standardcolor","graphic/color","core/utils","core/class"],function(a){var b=a("graphic/standardcolor"),c=a("graphic/color"),d=a("core/utils"),e=a("core/class").createClass("Palette",{constructor:function(){this.color={}},get:function(a){var d=this.color[a]||b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a]||"";return d?new c(d):null},getColorValue:function(a){return this.color[a]||b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a]||""},add:function(a,b){return this.color[a]="string"==typeof b?new c(b).toRGBA():b.toRGBA(),b},remove:function(a){return this.color.hasOwnProperty(a)?(delete this.color[a],!0):!1}});return d.extend(e,{getColor:function(a){var d=b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a];return d?new c(d):null},getColorValue:function(a){return b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a]||""},addColor:function(a,d){return b.EXTEND_STANDARD[a]="string"==typeof d?new c(d).toRGBA():d.toRGBA(),d},removeColor:function(a){return b.EXTEND_STANDARD.hasOwnProperty(a)?(delete b.EXTEND_STANDARD[a],!0):!1}}),e}),define("graphic/paper",["core/class","core/utils","graphic/svg","graphic/container","graphic/shapecontainer","graphic/shape","graphic/viewbox","graphic/eventhandler","graphic/shapeevent","graphic/styled","graphic/matrix","graphic/box","graphic/point","graphic/data","graphic/pen"],function(a){var b=a("core/class"),c=a("core/utils"),d=a("graphic/svg"),e=a("graphic/container"),f=a("graphic/shapecontainer"),g=a("graphic/viewbox"),h=a("graphic/eventhandler"),i=a("graphic/styled"),j=a("graphic/matrix"),k=b.createClass("Paper",{mixins:[f,h,i,g],constructor:function(a){this.callBase(),this.node=this.createSVGNode(),this.node.paper=this,this.node.appendChild(this.resourceNode=d.createNode("defs")),this.node.appendChild(this.shapeNode=d.createNode("g")),this.resources=new e,this.setWidth("100%").setHeight("100%"),a&&this.renderTo(a),this.callMixin() -},renderTo:function(a){c.isString(a)&&(a=document.getElementById(a)),this.container=a,a.appendChild(this.node)},createSVGNode:function(){var a=d.createNode("svg");return a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),a},getNode:function(){return this.node},getContainer:function(){return this.container},getWidth:function(){return this.node.clientWidth},setWidth:function(a){return this.node.setAttribute("width",a),this},getHeight:function(){return this.node.clientHeight},setHeight:function(a){return this.node.setAttribute("height",a),this},setViewPort:function(a,b,c){var d,e;1==arguments.length&&(d=arguments[0],a=d.center.x,b=d.center.y,c=d.zoom),c=c||1,e=this.getViewBox();var f=new j,g=e.x+e.width/2-a,h=e.y+e.height/2-b;return f.translate(-a,-b),f.scale(c),f.translate(a,b),f.translate(g,h),this.shapeNode.setAttribute("transform","matrix("+f+")"),this.viewport={center:{x:a,y:b},offset:{x:g,y:h},zoom:c},this},getViewPort:function(){if(!this.viewport){var a=this.getViewBox();return{zoom:1,center:{x:a.x+a.width/2,y:a.y+a.height/2},offset:{x:0,y:0}}}return this.viewport},getViewPortTransform:function(){var a=this.shapeNode.getCTM();return new j(a.a,a.b,a.c,a.d,a.e,a.f)},getTransform:function(){return this.getViewPortTransform().reverse()},addResource:function(a){return this.resources.appendItem(a),a.node&&this.resourceNode.appendChild(a.node),this},removeResource:function(a){return a.remove&&a.remove(),a.node&&this.resourceNode.removeChild(a.node),this},getPaper:function(){return this}}),l=a("graphic/shape");return b.extendClass(l,{getPaper:function(){for(var a=this.container;a&&a instanceof k==!1;)a=a.container;return a},isAttached:function(){return!!this.getPaper()},whenPaperReady:function(a){function b(){var b=c.getPaper();return b&&a&&a.call(c,b),b}var c=this;return b()||this.on("add treeadd",function d(){b()&&(c.off("add",d),c.off("treeadd",d))}),this}}),k}),define("graphic/path",["core/utils","core/class","graphic/shape","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box","graphic/geometry","graphic/point","graphic/vector"],function(a){var b=a("core/utils"),c=a("core/class").createClass,d=a("graphic/shape"),e=a("graphic/svg"),f=a("graphic/geometry"),g=Array.prototype.slice,h=(b.flatten,c("PathDrawer",{constructor:function(a){this.segment=[],this.path=a,this.__clear=!1},getPath:function(){return this.path},redraw:function(){return this._transation=this._transation||[],this.clear()},done:function(){var a=this._transation;return this._transation=null,this.push(a),this},clear:function(){return this._transation?this._transation=[]:this.path.setPathData("M 0 0"),this._clear=!0,this},push:function(){var a,b=g.call(arguments);return this._transation?(this._transation.push(b),this):(this._clear?(a="",this._clear=!1):a=this.path.getPathData(),a=a||"",this.path.setPathData(a+f.pathToString(b)),this)},moveTo:function(){return this.push("M",g.call(arguments))},moveBy:function(){return this.push("m",g.call(arguments))},lineTo:function(){return this.push("L",g.call(arguments))},lineBy:function(){return this.push("l",g.call(arguments))},arcTo:function(){return this.push("A",g.call(arguments))},arcBy:function(){return this.push("a",arguments)},carcTo:function(a){return this.push("A",[a,a,0].concat(g.call(arguments,1)))},carcBy:function(a){return this.push("a",[a,a,0].concat(g.call(arguments,1)))},bezierTo:function(){return this.push("C",g.call(arguments))},bezierBy:function(){return this.push("c",g.call(arguments))},close:function(){return this.push("z")}}));return c("Path",{base:d,constructor:function(a){this.callBase("path"),a&&this.setPathData(a),this.node.setAttribute("fill",e.defaults.fill),this.node.setAttribute("stroke",e.defaults.stroke)},setPathData:function(a){return a=a||"M0,0",this.pathdata=f.pathToString(a),this.node.setAttribute("d",this.pathdata),this.trigger("shapeupdate",{type:"pathdata"}),this},getPathData:function(){return this.pathdata||""},getDrawer:function(){return new h(this)},isClosed:function(){var a=this.getPathData();return!!~a.indexOf("z")||!!~a.indexOf("Z")}})}),define("graphic/patternbrush",["graphic/defbrush","core/class","graphic/resource","graphic/shapecontainer","graphic/container","core/utils","graphic/shape","graphic/svg"],function(a){{var b=a("graphic/defbrush"),c=a("graphic/shapecontainer");a("graphic/svg")}return a("core/class").createClass("PatternBrush",{base:b,mixins:[c],constructor:function(){this.callBase("pattern"),this.node.setAttribute("patternUnits","userSpaceOnUse")},setX:function(a){return this.x=a,this.node.setAttribute("x",a),this},setY:function(a){return this.y=a,this.node.setAttribute("y",a),this},setWidth:function(a){return this.width=a,this.node.setAttribute("width",a),this},setHeight:function(a){return this.height=a,this.node.setAttribute("height",a),this},getWidth:function(){return this.width},getHeight:function(){return this.height}})}),define("graphic/pen",["graphic/color","core/utils","graphic/standardcolor","core/class"],function(a){var b=a("graphic/color");return a("core/class").createClass("Pen",{constructor:function(a,b){this.brush=a,this.width=b||1,this.linecap=null,this.linejoin=null,this.dashArray=null,this.opacity=1},getBrush:function(){return this.brush},setBrush:function(a){return this.brush=a,this},setColor:function(a){return this.setBrush(a)},getColor:function(){return this.brush instanceof b?this.brush:null},getWidth:function(){return this.width},setWidth:function(a){return this.width=a,this},getOpacity:function(){return this.opacity},setOpacity:function(a){this.opacity=a},getLineCap:function(){return this.linecap},setLineCap:function(a){return this.linecap=a,this},getLineJoin:function(){return this.linejoin},setLineJoin:function(a){return this.linejoin=a,this},getDashArray:function(){return this.dashArray},setDashArray:function(a){return this.dashArray=a,this},stroke:function(a){var b=a.node;b.setAttribute("stroke",this.brush.toString()),b.setAttribute("stroke-width",this.getWidth()),this.getOpacity()<1&&b.setAttribute("stroke-opacity",this.getOpacity()),this.getLineCap()&&b.setAttribute("stroke-linecap",this.getLineCap()),this.getLineJoin()&&b.setAttribute("stroke-linejoin",this.getLineJoin()),this.getDashArray()&&b.setAttribute("stroke-dasharray",this.getDashArray())}})}),define("graphic/pie",["core/class","graphic/sweep","graphic/point","graphic/path"],function(a){return a("core/class").createClass({base:a("graphic/sweep"),constructor:function(a,b,c){this.callBase([0,a],b,c)},getRadius:function(){return this.getSectionArray()[1]},setRadius:function(a){this.setSectionArray([0,a])}})}),define("graphic/point",["core/class"],function(a){var b=a("core/class").createClass("Point",{constructor:function(a,b){this.x=a||0,this.y=b||0},offset:function(a,c){return 1==arguments.length&&(c=a.y,a=a.x),new b(this.x+a,this.y+c)},valueOf:function(){return[this.x,this.y]},toString:function(){return this.valueOf().join(" ")},spof:function(){return new b((0|this.x)+.5,(0|this.y)+.5)}});return b.fromPolar=function(a,c,d){return"rad"!=d&&(c=c/180*Math.PI),new b(a*Math.cos(c),a*Math.sin(c))},b.parse=function(a){return a instanceof b?a:"string"==typeof a?b.parse(a.split(/\s*[\s,]\s*/)):"0"in a&&"1"in a?new b(a[0],a[1]):void 0},b}),define("graphic/pointcontainer",["core/class","graphic/container"],function(a){return a("core/class").createClass("PointContainer",{base:a("graphic/container"),constructor:function(){this.callBase()},addPoint:function(){return this.addItem.apply(this,arguments)},prependPoint:function(){return this.prependItem.apply(this,arguments)},appendPoint:function(){return this.appendItem.apply(this,arguments)},removePoint:function(){return this.removeItem.apply(this,arguments)},addPoints:function(){return this.addItems.apply(this,arguments)},setPoints:function(){return this.setItems.apply(this,arguments)},getPoint:function(){return this.getItem.apply(this,arguments)},getPoints:function(){return this.getItems.apply(this,arguments)},getFirstPoint:function(){return this.getFirstItem.apply(this,arguments)},getLastPoint:function(){return this.getLastItem.apply(this,arguments)}})}),define("graphic/poly",["core/utils","core/class","graphic/path","graphic/shape","graphic/svg","graphic/geometry","graphic/pointcontainer","graphic/container"],function(a){a("core/utils");return a("core/class").createClass("Poly",{base:a("graphic/path"),mixins:[a("graphic/pointcontainer")],constructor:function(a,b){this.callBase(),this.closeable=!!b,this.setPoints(a||[]),this.changeable=!0,this.update()},onContainerChanged:function(){this.changeable&&this.update()},update:function(){var a=this.getDrawer(),b=this.getPoints();if(a.clear(),!b.length)return this;a.moveTo(b[0]);for(var c,d=1,e=b.length;e>d;d++)c=b[d],a.lineTo(c);return this.closeable&&b.length>2&&a.close(),this}})}),define("graphic/polygon",["core/class","graphic/poly","core/utils","graphic/path","graphic/pointcontainer"],function(a){return a("core/class").createClass("Polygon",{base:a("graphic/poly"),constructor:function(a){this.callBase(a,!0)}})}),define("graphic/polyline",["core/class","graphic/poly","core/utils","graphic/path","graphic/pointcontainer"],function(a){return a("core/class").createClass("Polyline",{base:a("graphic/poly"),constructor:function(a){this.callBase(a)}})}),define("graphic/radialgradientbrush",["graphic/gradientbrush","graphic/svg","graphic/defbrush","graphic/color","core/class"],function(a){var b=a("graphic/gradientbrush");return a("core/class").createClass("RadialGradientBrush",{base:b,constructor:function(a){this.callBase("radialGradient"),this.setCenter(.5,.5),this.setFocal(.5,.5),this.setRadius(.5),"function"==typeof a&&a.call(this,this)},setCenter:function(a,b){return this.node.setAttribute("cx",a),this.node.setAttribute("cy",b),this},getCenter:function(){return{x:+this.node.getAttribute("cx"),y:+this.node.getAttribute("cy")}},setFocal:function(a,b){return this.node.setAttribute("fx",a),this.node.setAttribute("fy",b),this},getFocal:function(){return{x:+this.node.getAttribute("fx"),y:+this.node.getAttribute("fy")}},setRadius:function(a){return this.node.setAttribute("r",a),this},getRadius:function(){return+this.node.getAttribute("r")}})}),define("graphic/rect",["core/utils","graphic/point","core/class","graphic/box","graphic/path","graphic/shape","graphic/svg","graphic/geometry"],function(a){var b={},c=a("core/utils"),d=a("graphic/point"),e=a("graphic/box");c.extend(b,{formatRadius:function(a,b,c){var d=Math.floor(Math.min(a/2,b/2));return Math.min(d,c)}});var f=a("core/class").createClass("Rect",{base:a("graphic/path"),constructor:function(a,c,d,e,f){this.callBase(),this.x=d||0,this.y=e||0,this.width=a||0,this.height=c||0,this.radius=b.formatRadius(this.width,this.height,f||0),this.update()},update:function(){var a=this.x,b=this.y,c=this.width,d=this.height,e=this.radius,f=this.getDrawer().redraw();return e?(c-=2*e,d-=2*e,f.push("M",a+e,b),f.push("h",c),f.push("a",e,e,0,0,1,e,e),f.push("v",d),f.push("a",e,e,0,0,1,-e,e),f.push("h",-c),f.push("a",e,e,0,0,1,-e,-e),f.push("v",-d),f.push("a",e,e,0,0,1,e,-e),f.push("z")):(f.push("M",a,b),f.push("h",c),f.push("v",d),f.push("h",-c),f.push("z")),f.done(),this},setWidth:function(a){return this.width=a,this.update()},setHeight:function(a){return this.height=a,this.update()},setSize:function(a,b){return this.width=a,this.height=b,this.update()},setBox:function(a){return this.x=a.x,this.y=a.y,this.width=a.width,this.height=a.height,this.update()},getBox:function(){return new e(this.x,this.y,this.width,this.height)},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=a,this.update()},getPosition:function(){return new d(this.x,this.y)},setPosition:function(a,b){if(1==arguments.length){var c=d.parse(arguments[0]);b=c.y,a=c.x}return this.x=a,this.y=b,this.update()},getWidth:function(){return this.width},getHeight:function(){return this.height},getPositionX:function(){return this.x},getPositionY:function(){return this.y},setPositionX:function(a){return this.x=a,this.update()},setPositionY:function(a){return this.y=a,this.update()}});return f}),define("graphic/regularpolygon",["graphic/point","core/class","graphic/path","core/utils","graphic/shape","graphic/svg","graphic/geometry"],function(a){var b=a("graphic/point");return a("core/class").createClass("RegularPolygon",{base:a("graphic/path"),constructor:function(a,c,d,e){this.callBase(),this.radius=c||0,this.side=Math.max(a||3,3),arguments.length>2&&3==arguments.length&&(e=d.y,d=d.x),this.center=new b(d,e),this.draw()},getSide:function(){return this.side},setSide:function(a){return this.side=a,this.draw()},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=a,this.draw()},draw:function(){var a,c=this.radius,d=this.side,e=2*Math.PI/d,f=this.getDrawer();for(f.clear(),f.moveTo(b.fromPolar(c,Math.PI/2,"rad").offset(this.center)),a=0;d>=a;a++)f.lineTo(b.fromPolar(c,e*a+Math.PI/2,"rad").offset(this.center));return f.close(),this}})}),define("graphic/resource",["graphic/svg","core/class"],function(a){var b=a("graphic/svg");return a("core/class").createClass("Resource",{constructor:function(a){this.callBase(),this.node=b.createNode(a)},toString:function(){return"url(#"+this.node.id+")"}})}),define("graphic/ring",["core/class","graphic/sweep","graphic/point","graphic/path"],function(a){return a("core/class").createClass({base:a("graphic/sweep"),constructor:function(a,b){this.callBase([a,b],360,0)},getInnerRadius:function(){return this.getSectionArray()[0]},getOuterRadius:function(){return this.getSectionArray()[1]},setInnerRadius:function(a){this.setSectionArray([a,this.getOuterRadius()])},setOuterRadius:function(a){this.setSectionArray([this.getInnerRadius(),a])}})}),define("graphic/shape",["graphic/svg","core/utils","graphic/eventhandler","graphic/shapeevent","core/class","graphic/styled","graphic/data","graphic/matrix","graphic/box","graphic/point","graphic/pen","graphic/color"],function(a){var b=a("graphic/svg"),c=a("core/utils"),d=a("graphic/eventhandler"),e=a("graphic/styled"),f=a("graphic/data"),g=a("graphic/matrix"),h=(a("graphic/pen"),Array.prototype.slice),i=a("graphic/box"),j=a("core/class").createClass("Shape",{mixins:[d,e,f],constructor:function(a){this.node=b.createNode(a),this.node.shape=this,this.transform={translate:null,rotate:null,scale:null,matrix:null},this.callMixin()},getId:function(){return this.node.id},setId:function(a){return this.node.id=a,this},getNode:function(){return this.node},getBoundaryBox:function(){var a;try{a=this.node.getBBox()}catch(b){a={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}return new i(a)},getRenderBox:function(a){var b=this.getBoundaryBox(),c=this.getTransform(a);return c.transformBox(b)},getWidth:function(){return this.getRenderBox().width},getHeight:function(){return this.getRenderBox().height},getSize:function(){var a=this.getRenderBox();return delete a.x,delete a.y,a},setOpacity:function(a){return this.node.setAttribute("opacity",a),this},getOpacity:function(){var a=this.node.getAttribute("opacity");return a?+a:1},setVisible:function(a){return a?this.node.removeAttribute("display"):this.node.setAttribute("display","none"),this},getVisible:function(){this.node.getAttribute("display")},hasAncestor:function(a){for(var b=this.container;b;){if(b===a)return!0;b=b.container}return!1},getTransform:function(a){return g.getCTM(this,a)},clearTransform:function(){return this.node.removeAttribute("transform"),this.transform={translate:null,rotate:null,scale:null,matrix:null},this.trigger("shapeupdate",{type:"transform"}),this},_applyTransform:function(){var a=this.transform,b=[];return a.translate&&b.push(["translate(",a.translate,")"]),a.rotate&&b.push(["rotate(",a.rotate,")"]),a.scale&&b.push(["scale(",a.scale,")"]),a.matrix&&b.push(["matrix(",a.matrix,")"]),this.node.setAttribute("transform",c.flatten(b).join(" ")),this},setMatrix:function(a){return this.transform.matrix=a,this._applyTransform()},setTranslate:function(a){return this.transform.translate=null!==a&&h.call(arguments)||null,this._applyTransform()},setRotate:function(a){return this.transform.rotate=null!==a&&h.call(arguments)||null,this._applyTransform()},setScale:function(a){return this.transform.scale=null!==a&&h.call(arguments)||null,this._applyTransform()},translate:function(a,b){var c=this.transform.matrix||new g;return void 0===b&&(b=0),this.transform.matrix=c.translate(a,b),this._applyTransform()},rotate:function(a){var b=this.transform.matrix||new g;return this.transform.matrix=b.rotate(a),this._applyTransform()},scale:function(a,b){var c=this.transform.matrix||new g;return void 0===b&&(b=a),this.transform.matrix=c.scale(a,b),this._applyTransform()},skew:function(a,b){var c=this.transform.matrix||new g;return void 0===b&&(b=a),this.transform.matrix=c.skew(a,b),this._applyTransform()},stroke:function(a,b){return a&&a.stroke?a.stroke(this):a?(this.node.setAttribute("stroke",a.toString()),b&&this.node.setAttribute("stroke-width",b)):null===a&&this.node.removeAttribute("stroe"),this},fill:function(a){return a&&this.node.setAttribute("fill",a.toString()),null===a&&this.node.removeAttribute("fill"),this},setAttr:function(a,b){var d=this;return c.isObject(a)&&c.each(a,function(a,b){d.setAttr(b,a)}),void 0===b||null===b||""===b?this.node.removeAttribute(a):this.node.setAttribute(a,b),this},getAttr:function(a){return this.node.getAttribute(a)}});return j}),define("graphic/shapecontainer",["graphic/container","core/class","core/utils","graphic/shape","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("graphic/container"),c=a("core/utils"),d=a("core/class").createClass("ShapeContainer",{base:b,isShapeContainer:!0,handleAdd:function(a,b){var c=this.getShapeNode();c.insertBefore(a.node,c.childNodes[b]||null),a.trigger("add",{container:this}),a.notifyTreeModification&&a.notifyTreeModification("treeadd",this)},handleRemove:function(a){var b=this.getShapeNode();b.removeChild(a.node),a.trigger("remove",{container:this}),a.notifyTreeModification&&a.notifyTreeModification("treeremove",this)},notifyTreeModification:function(a,b){this.eachItem(function(c,d){d.notifyTreeModification&&d.notifyTreeModification(a,b),d.trigger(a,{container:b})})},getShape:function(a){return this.getItem(a)},addShape:function(a,b){return this.addItem(a,b)},put:function(a){return this.addShape(a),a},appendShape:function(a){return this.addShape(a)},prependShape:function(a){return this.addShape(a,0)},replaceShape:function(a,b){var c=this.indexOf(b);if(-1!==c)return this.removeShape(c),this.addShape(a,c),this},addShapeBefore:function(a,b){var c=this.indexOf(b);return this.addShape(a,c)},addShapeAfter:function(a,b){var c=this.indexOf(b);return this.addShape(a,-1===c?void 0:c+1)},addShapes:function(a){return this.addItems(a)},removeShape:function(a){return this.removeItem(a)},getShapes:function(){return this.getItems()},getShapesByType:function(a){function b(e){a.toLowerCase()==e.getType().toLowerCase()&&d.push(e),e.isShapeContainer&&c.each(e.getShapes(),function(a){b(a)})}var d=[];return b(this),d},getShapeById:function(a){return this.getShapeNode().getElementById(a).shape},arrangeShape:function(a,b){return this.removeShape(a).addShape(a,b)},getShapeNode:function(){return this.shapeNode||this.node}}),e=a("graphic/shape");return a("core/class").extendClass(e,{bringTo:function(a){return this.container.arrangeShape(this,a),this},bringFront:function(){return this.bringTo(this.container.indexOf(this)+1)},bringBack:function(){return this.bringTo(this.container.indexOf(this)-1)},bringTop:function(){return this.container.removeShape(this).addShape(this),this},bringRear:function(){return this.bringTo(0)},bringRefer:function(a,b){return a.container&&(this.remove&&this.remove(),a.container.addShape(this,a.container.indexOf(a)+(b||0))),this},bringAbove:function(a){return this.bringRefer(a)},bringBelow:function(a){return this.bringRefer(a,1)},replaceBy:function(a){return this.container&&(a.bringAbove(this),this.remove()),this}}),d}),define("graphic/shapeevent",["graphic/matrix","core/utils","graphic/box","graphic/point","core/class"],function(a){{var b=a("graphic/matrix"),c=a("core/utils");a("graphic/point")}return a("core/class").createClass("ShapeEvent",{constructor:function(a){var b=null;c.isObject(a.target)?c.extend(this,a):(this.type=a.type,b=a.target,b.correspondingUseElement&&(b=b.correspondingUseElement),this.originEvent=a,this.targetShape=b.shape||b.paper||a.currentTarget&&(a.currentTarget.shape||a.currentTarget.paper),a._kityParam&&c.extend(this,a._kityParam))},preventDefault:function(){var a=this.originEvent;return a?a.preventDefault?(a.preventDefault(),a.cancelable):(a.returnValue=!1,!0):!0},getPosition:function(a,c){if(!this.originEvent)return null;var d=this.originEvent.touches?this.originEvent.touches[c||0]:this.originEvent,e=this.targetShape,f=e.shapeNode||e.node,g=new kity.Point(d&&d.clientX||0,d&&d.clientY||0),h=b.transformPoint(g,f.getScreenCTM().inverse()),i=b.getCTM(e,a||"view").transformPoint(h);return i},stopPropagation:function(){var a=this.originEvent;return a?void(a.stopPropagation?a.stopPropagation():a.cancelBubble=!1):!0}})}),define("graphic/shapepoint",["core/class","graphic/point"],function(a){return a("core/class").createClass("ShapePoint",{base:a("graphic/point"),constructor:function(a,b){this.callBase(a,b)},setX:function(a){return this.setPoint(a,this.y)},setY:function(a){return this.setPoint(this.x,a)},setPoint:function(a,b){return this.x=a,this.y=b,this.update(),this},getPoint:function(){return this},update:function(){return this.container&&this.container.update&&this.container.update(),this}})}),define("graphic/standardcolor",[],{COLOR_STANDARD:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00"},EXTEND_STANDARD:{}}),define("graphic/star",["graphic/point","core/class","graphic/path","core/utils","graphic/shape","graphic/svg","graphic/geometry"],function(a){var b={3:.2,5:.38196601125,6:.57735026919,8:.541196100146,10:.726542528005,12:.707106781187},c=a("graphic/point");return a("core/class").createClass("Star",{base:a("graphic/path"),constructor:function(a,b,d,e,f){this.callBase(),this.vertex=a||3,this.radius=b||0,this.shrink=d,this.offset=e||new c(0,0),this.angleOffset=f||0,this.draw()},getVertex:function(){return this.vertex},setVertex:function(a){return this.vertex=a,this.draw()},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=a,this.draw()},getShrink:function(){return this.shrink},setShrink:function(a){return this.shrink=a,this.draw()},getOffset:function(){return this.offset},setOffset:function(a){return this.offset=a,this.draw()},getAngleOffset:function(){return this.angleOffset},setAngleOffset:function(a){return this.angleOffset=a,this.draw()},draw:function(){var a,d,e=this.radius,f=this.radius*(this.shrink||b[this.vertex]||.5),g=this.vertex,h=this.offset,i=90,j=180/g,k=this.angleOffset,l=this.getDrawer();for(l.clear(),l.moveTo(c.fromPolar(f,i)),a=1;2*g>=a;a++)d=i+j*a,l.lineTo(a%2?c.fromPolar(e,d+k).offset(h):c.fromPolar(f,d));l.close()}})}),define("graphic/styled",["core/class"],function(a){function b(a){return a.classList||(a.classList=new c(a)),a.classList}var c=a("core/class").createClass("ClassList",{constructor:function(a){this._node=a,this._list=a.className.toString().split(" ")},_update:function(){this._node.className=this._list.join(" ")},add:function(a){this._list.push(a),this._update()},remove:function(a){var b=this._list.indexOf(a);~b&&this._list.splice(b,1),this._update()},contains:function(a){return!!~this._list.indexOf(a)}});return a("core/class").createClass("Styled",{addClass:function(a){return b(this.node).add(a),this},removeClass:function(a){return b(this.node).remove(a),this},hasClass:function(a){return b(this.node).contains(a)},setStyle:function(a){if(2==arguments.length)return this.node.style[arguments[0]]=arguments[1],this;for(var b in a)a.hasOwnProperty(b)&&(this.node.style[b]=a[b]);return this}})}),define("graphic/svg",[],function(){var a=document,b=0,c={createNode:function(d){var e=a.createElementNS(c.ns,d);return e.id="kity_"+d+"_"+b++,e},defaults:{stroke:"none",fill:"none"},xlink:"http://www.w3.org/1999/xlink",ns:"http://www.w3.org/2000/svg"};return c}),define("graphic/sweep",["graphic/point","core/class","graphic/path","core/utils","graphic/shape","graphic/svg","graphic/geometry"],function(a){var b=a("graphic/point");return a("core/class").createClass("Sweep",{base:a("graphic/path"),constructor:function(a,b,c){this.callBase(),this.sectionArray=a||[],this.angle=b||0,this.angleOffset=c||0,this.draw()},getSectionArray:function(){return this.sectionArray},setSectionArray:function(a){return this.sectionArray=a,this.draw()},getAngle:function(){return this.angle},setAngle:function(a){return this.angle=a,this.draw()},getAngleOffset:function(){return this.angleOffset},setAngleOffset:function(a){return this.angleOffset=a,this.draw()},draw:function(){var a,b=this.sectionArray;for(a=0;a0?1:-1;return 180*c*b/Math.PI}});return d.fromPoints=function(a,b){return new d(b.x-a.x,b.y-a.y)},a("core/class").extendClass(b,{asVector:function(){return new d(this.x,this.y)}}),d}),define("graphic/view",["graphic/shapecontainer","graphic/container","core/utils","core/class","graphic/shape","graphic/viewbox","graphic/view"],function(a){var b=a("graphic/shapecontainer"),c=a("graphic/viewbox");return a("core/class").createClass("View",{mixins:[b,c],base:a("graphic/view"),constructor:function(){this.callBase("view")}})}),define("graphic/viewbox",["core/class"],function(a){return a("core/class").createClass("ViewBox",{getViewBox:function(){var a=this.node.getAttribute("viewBox");return null===a?{x:0,y:0,width:this.node.clientWidth||this.node.parentNode.clientWidth,height:this.node.clientHeight||this.node.parentNode.clientHeight}:(a=a.split(" "),{x:+a[0],y:+a[1],width:+a[2],height:+a[3]})},setViewBox:function(a,b,c,d){return this.node.setAttribute("viewBox",[a,b,c,d].join(" ")),this}})}),define("kity",["core/utils","core/class","core/browser","graphic/box","graphic/bezier","graphic/pointcontainer","graphic/path","graphic/bezierpoint","graphic/shapepoint","graphic/vector","graphic/circle","graphic/ellipse","graphic/clip","graphic/shape","graphic/shapecontainer","graphic/color","graphic/standardcolor","graphic/container","graphic/curve","graphic/point","graphic/gradientbrush","graphic/svg","graphic/defbrush","graphic/group","graphic/hyperlink","graphic/image","graphic/line","graphic/lineargradientbrush","graphic/mask","graphic/matrix","graphic/marker","graphic/resource","graphic/viewbox","graphic/palette","graphic/paper","graphic/eventhandler","graphic/styled","graphic/geometry","graphic/patternbrush","graphic/pen","graphic/polygon","graphic/poly","graphic/polyline","graphic/pie","graphic/sweep","graphic/radialgradientbrush","graphic/rect","graphic/regularpolygon","graphic/ring","graphic/data","graphic/star","graphic/text","graphic/textcontent","graphic/textspan","graphic/use","animate/animator","animate/timeline","animate/easing","animate/opacityanimator","animate/rotateanimator","animate/scaleanimator","animate/frame","animate/translateanimator","animate/pathanimator","animate/motionanimator","filter/filter","filter/effectcontainer","filter/gaussianblurfilter","filter/effect/gaussianblureffect","filter/projectionfilter","filter/effect/effect","filter/effect/colormatrixeffect","filter/effect/compositeeffect","filter/effect/offseteffect","filter/effect/convolvematrixeffect"],function(a){var b={},c=a("core/utils");return b.version="2.0.0",c.extend(b,{createClass:a("core/class").createClass,extendClass:a("core/class").extendClass,Utils:c,Browser:a("core/browser"),Box:a("graphic/box"),Bezier:a("graphic/bezier"),BezierPoint:a("graphic/bezierpoint"),Circle:a("graphic/circle"),Clip:a("graphic/clip"),Color:a("graphic/color"),Container:a("graphic/container"),Curve:a("graphic/curve"),Ellipse:a("graphic/ellipse"),GradientBrush:a("graphic/gradientbrush"),Group:a("graphic/group"),HyperLink:a("graphic/hyperlink"),Image:a("graphic/image"),Line:a("graphic/line"),LinearGradientBrush:a("graphic/lineargradientbrush"),Mask:a("graphic/mask"),Matrix:a("graphic/matrix"),Marker:a("graphic/marker"),Palette:a("graphic/palette"),Paper:a("graphic/paper"),Path:a("graphic/path"),PatternBrush:a("graphic/patternbrush"),Pen:a("graphic/pen"),Point:a("graphic/point"),PointContainer:a("graphic/pointcontainer"),Polygon:a("graphic/polygon"),Polyline:a("graphic/polyline"),Pie:a("graphic/pie"),RadialGradientBrush:a("graphic/radialgradientbrush"),Rect:a("graphic/rect"),RegularPolygon:a("graphic/regularpolygon"),Ring:a("graphic/ring"),Shape:a("graphic/shape"),ShapePoint:a("graphic/shapepoint"),ShapeContainer:a("graphic/shapecontainer"),Sweep:a("graphic/sweep"),Star:a("graphic/star"),Text:a("graphic/text"),TextSpan:a("graphic/textspan"),Use:a("graphic/use"),Vector:a("graphic/vector"),g:a("graphic/geometry"),Animator:a("animate/animator"),Easing:a("animate/easing"),OpacityAnimator:a("animate/opacityanimator"),RotateAnimator:a("animate/rotateanimator"),ScaleAnimator:a("animate/scaleanimator"),Timeline:a("animate/timeline"),TranslateAnimator:a("animate/translateanimator"),PathAnimator:a("animate/pathanimator"),MotionAnimator:a("animate/motionanimator"),requestFrame:a("animate/frame").requestFrame,releaseFrame:a("animate/frame").releaseFrame,Filter:a("filter/filter"),GaussianblurFilter:a("filter/gaussianblurfilter"),ProjectionFilter:a("filter/projectionfilter"),ColorMatrixEffect:a("filter/effect/colormatrixeffect"),CompositeEffect:a("filter/effect/compositeeffect"),ConvolveMatrixEffect:a("filter/effect/convolvematrixeffect"),Effect:a("filter/effect/effect"),GaussianblurEffect:a("filter/effect/gaussianblureffect"),OffsetEffect:a("filter/effect/offseteffect")}),window.kity=b}),function(){try{inc.use("kity")}catch(a){use("kity")}}()}(); \ No newline at end of file + +!function(){function use(a){_p.r([moduleMapping[a]])}var _p={r:function(a){if(_p[a].inited)return _p[a].value;if("function"!=typeof _p[a].value)return _p[a].inited=!0,_p[a].value;var b={exports:{}},c=_p[a].value(null,b.exports,b);if(_p[a].inited=!0,_p[a].value=c,void 0!==c)return c;for(var d in b.exports)if(b.exports.hasOwnProperty(d))return _p[a].inited=!0,_p[a].value=b.exports,b.exports}};_p[0]={value:function(){function a(a){var b=parseFloat(a,10);return/ms/.test(a)?b:/s/.test(a)?1e3*b:/min/.test(a)?60*b*1e3:b}var b=_p.r(8),c=_p.r(1),d=_p.r(11).createClass("Animator",{constructor:function(a,b,c){if(1==arguments.length){var d=arguments[0];this.beginValue=d.beginValue,this.finishValue=d.finishValue,this.setter=d.setter}else this.beginValue=a,this.finishValue=b,this.setter=c},start:function(b,c,d,e,f){2===arguments.length&&"object"==typeof c&&(d=c.easing,e=c.delay,f=c.callback,c=c.duration),4===arguments.length&&"function"==typeof e&&(f=e,e=0);var g=this.create(b,c,d,f);return e=a(e),e>0?setTimeout(function(){g.play()},e):g.play(),g},create:function(e,f,g,h){var i;return f=f&&a(f)||d.DEFAULT_DURATION,g=g||d.DEFAULT_EASING,"string"==typeof g&&(g=c[g]),i=new b(this,e,f,g),"function"==typeof h&&i.on("finish",h),i},reverse:function(){return new d(this.finishValue,this.beginValue,this.setter)}});d.DEFAULT_DURATION=300,d.DEFAULT_EASING="linear";var e=_p.r(61);return _p.r(11).extendClass(e,{animate:function(a,b,c,d,e){function f(){g.shift(),g.length&&setTimeout(g[0].t.play.bind(g[0].t),g[0].d)}var g=this._KityAnimateQueue=this._KityAnimateQueue||[],h=a.create(this,b,c,e);return h.on("finish",f),g.push({t:h,d:d}),1==g.length&&setTimeout(h.play.bind(h),d),this},timeline:function(){return this._KityAnimateQueue[0].t},stop:function(){var a=this._KityAnimateQueue;if(a)for(;a.length;)a.shift().t.stop();return this}}),d}},_p[1]={value:function(){var a={linear:function(a,b,c,d){return c*(a/d)+b},swing:function(b,c,d,e){return a.easeOutQuad(b,c,d,e)},ease:function(b,c,d,e){return a.easeInOutCubic(b,c,d,e)},easeInQuad:function(a,b,c,d){return c*(a/=d)*a+b},easeOutQuad:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOutQuad:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},easeInCubic:function(a,b,c,d){return c*(a/=d)*a*a+b},easeOutCubic:function(a,b,c,d){return c*((a=a/d-1)*a*a+1)+b},easeInOutCubic:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a+b:c/2*((a-=2)*a*a+2)+b},easeInQuart:function(a,b,c,d){return c*(a/=d)*a*a*a+b},easeOutQuart:function(a,b,c,d){return-c*((a=a/d-1)*a*a*a-1)+b},easeInOutQuart:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a+b:-c/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(a,b,c,d){return c*(a/=d)*a*a*a*a+b},easeOutQuint:function(a,b,c,d){return c*((a=a/d-1)*a*a*a*a+1)+b},easeInOutQuint:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a*a+b:c/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(a,b,c,d){return-c*Math.cos(a/d*(Math.PI/2))+c+b},easeOutSine:function(a,b,c,d){return c*Math.sin(a/d*(Math.PI/2))+b},easeInOutSine:function(a,b,c,d){return-c/2*(Math.cos(Math.PI*a/d)-1)+b},easeInExpo:function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b},easeOutExpo:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOutExpo:function(a,b,c,d){return 0===a?b:a==d?b+c:(a/=d/2)<1?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(a,b,c,d){return-c*(Math.sqrt(1-(a/=d)*a)-1)+b},easeOutCirc:function(a,b,c,d){return c*Math.sqrt(1-(a=a/d-1)*a)+b},easeInOutCirc:function(a,b,c,d){return(a/=d/2)<1?-c/2*(Math.sqrt(1-a*a)-1)+b:c/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(a,b,c,d){var e=1.70158,f=0,g=c;return 0===a?b:1==(a/=d)?b+c:(f||(f=.3*d),ga?-.5*g*Math.pow(2,10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f)+b:g*Math.pow(2,-10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f)*.5+c+b},easeInBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),c*(a/=d)*a*((e+1)*a-e)+b},easeOutBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),c*((a=a/d-1)*a*((e+1)*a+e)+1)+b},easeInOutBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),(a/=d/2)<1?c/2*a*a*(((e*=1.525)+1)*a-e)+b:c/2*((a-=2)*a*(((e*=1.525)+1)*a+e)+2)+b},easeInBounce:function(b,c,d,e){return d-a.easeOutBounce(e-b,0,d,e)+c},easeOutBounce:function(a,b,c,d){return(a/=d)<1/2.75?7.5625*c*a*a+b:2/2.75>a?c*(7.5625*(a-=1.5/2.75)*a+.75)+b:2.5/2.75>a?c*(7.5625*(a-=2.25/2.75)*a+.9375)+b:c*(7.5625*(a-=2.625/2.75)*a+.984375)+b},easeInOutBounce:function(b,c,d,e){return e/2>b?.5*a.easeInBounce(2*b,0,d,e)+c:.5*a.easeOutBounce(2*b-e,0,d,e)+.5*d+c}};return a}},_p[2]={value:function(a,b){function c(a){1===l.push(a)&&(i=j(d))}function d(){var a=l;for(l=[];a.length;)h(a.pop());i=0}function e(a){var b=g(a);return c(b),b}function f(a){var b=l.indexOf(a);~b&&l.splice(b,1),0===l.length&&k(i)}function g(a){var b={index:0,time:+new Date,elapsed:0,action:a,next:function(){c(b)}};return b}function h(a){var b=+new Date,c=b-a.time;c>200&&(c=1e3/60),a.dur=c,a.elapsed+=c,a.time=b,a.action.call(null,a),a.index++}var i,j=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(a){return setTimeout(a,1e3/60)},k=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||window.clearTimeout,l=[];b.requestFrame=e,b.releaseFrame=f}},_p[3]={value:function(){var a=_p.r(0),b=_p.r(35),c=_p.r(47),d=_p.r(61),e=_p.r(11).createClass("MotionAnimator",{base:a,constructor:function(a,d){var e=this;this.callBase({beginValue:0,finishValue:1,setter:function(a,d){var f=e.motionPath instanceof c?e.motionPath.getPathData():e.motionPath,g=b.pointAtPath(f,d);a.setTranslate(g.x,g.y),this.doRotate&&a.setRotate(g.tan.getAngle())}}),this.doRotate=d,this.motionPath=a}});return _p.r(11).extendClass(d,{motion:function(a,b,c,d,f){return this.animate(new e(a),b,c,d,f)}}),e}},_p[4]={value:function(){var a=_p.r(0),b=_p.r(11).createClass("OpacityAnimator",{base:a,constructor:function(a){this.callBase({beginValue:function(a){return a.getOpacity()},finishValue:a,setter:function(a,b){a.setOpacity(b)}})}}),c=_p.r(61);return _p.r(11).extendClass(c,{fxOpacity:function(a,c,d,e,f){return this.animate(new b(a),c,d,e,f)},fadeTo:function(){return this.fxOpacity.apply(this,arguments)},fadeIn:function(){return this.fxOpacity.apply(this,[1].concat([].slice.call(arguments)))},fadeOut:function(){return this.fxOpacity.apply(this,[0].concat([].slice.call(arguments)))}}),b}},_p[5]={value:function(){var a=_p.r(0),b=_p.r(35),c=_p.r(11).createClass("OpacityAnimator",{base:a,constructor:function(a){this.callBase({beginValue:function(a){return this.beginPath=a.getPathData(),0},finishValue:1,setter:function(c,d){c.setPathData(b.pathTween(this.beginPath,a,d))}})}}),d=_p.r(47);return _p.r(11).extendClass(d,{fxPath:function(a,b,d,e,f){return this.animate(new c(a),b,d,e,f)}}),c}},_p[6]={value:function(){var a=_p.r(0),b=_p.r(11).createClass("RotateAnimator",{base:a,constructor:function(a){this.callBase({beginValue:0,finishValue:a,setter:function(a,b,c){var d=c.getDelta();a.rotate(d,ax,ay)}})}}),c=_p.r(61);return _p.r(11).extendClass(c,{fxRotate:function(a,c,d,e,f){return this.animate(new b(a),c,d,e,f)}}),b}},_p[7]={value:function(){var a=_p.r(0),b=_p.r(11).createClass("ScaleAnimator",{base:a,constructor:function(a,b){this.callBase({beginValue:0,finishValue:1,setter:function(c,d,e){var f=e.getDelta(),g=Math.pow(a,f),h=Math.pow(b,f);c.scale(h,g)}})}}),c=_p.r(61);return _p.r(11).extendClass(c,{fxScale:function(a,c,d,e,f,g){return this.animate(new b(a,c),d,e,f,g)}}),b}},_p[8]={value:function(){function a(a,b,c){return f.paralle(a,b,function(a,b){return a+(b-a)*c})}function b(a,b){return f.paralle(a,b,function(a,b){return b-a})}function c(a,b,c){this.timeline=a,this.target=a.target,this.type=b;for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d])}var d=_p.r(34),e=_p.r(2),f=_p.r(12),g=_p.r(11).createClass("Timeline",{mixins:[d],constructor:function(a,b,c,d){this.callMixin(),this.target=b,this.time=0,this.duration=c,this.easing=d,this.animator=a,this.beginValue=a.beginValue,this.finishValue=a.finishValue,this.setter=a.setter,this.status="ready"},nextFrame:function(a){"playing"==this.status&&(this.time+=a.dur,this.setValue(this.getValue()),this.time>=this.duration&&this.timeUp(),a.next())},getPlayTime:function(){return this.rollbacking?this.duration-this.time:this.time},getTimeProportion:function(){return this.getPlayTime()/this.duration},getValueProportion:function(){return this.easing(this.getPlayTime(),0,1,this.duration)},getValue:function(){var b=this.beginValue,c=this.finishValue,d=this.getValueProportion();return a(b,c,d)},setValue:function(a){this.lastValue=this.currentValue,this.currentValue=a,this.setter.call(this.target,this.target,a,this)},getDelta:function(){return this.lastValue=void 0===this.lastValue?this.beginValue:this.lastValue,b(this.lastValue,this.currentValue)},play:function(){var a=this.status;switch(this.status="playing",a){case"ready":f.isFunction(this.beginValue)&&(this.beginValue=this.beginValue.call(this.target,this.target)),f.isFunction(this.finishValue)&&(this.finishValue=this.finishValue.call(this.target,this.target)),this.time=0,this.setValue(this.beginValue),this.frame=e.requestFrame(this.nextFrame.bind(this));break;case"finished":case"stoped":this.time=0,this.frame=e.requestFrame(this.nextFrame.bind(this));break;case"paused":this.frame.next()}return this.fire("play",new c(this,"play",{lastStatus:a})),this},pause:function(){return this.status="paused",this.fire("pause",new c(this,"pause")),e.releaseFrame(this.frame),this},stop:function(){return this.status="stoped",this.setValue(this.finishValue),this.rollbacking=!1,this.fire("stop",new c(this,"stop")),e.releaseFrame(this.frame),this},timeUp:function(){this.repeatOption?(this.time=0,this.rollback?this.rollbacking?(this.decreaseRepeat(),this.rollbacking=!1):(this.rollbacking=!0,this.fire("rollback",new c(this,"rollback"))):this.decreaseRepeat(),this.repeatOption?this.fire("repeat",new c(this,"repeat")):this.finish()):this.finish()},finish:function(){this.setValue(this.finishValue),this.status="finished",this.fire("finish",new c(this,"finish")),e.releaseFrame(this.frame)},decreaseRepeat:function(){this.repeatOption!==!0&&this.repeatOption--},repeat:function(a,b){return this.repeatOption=a,this.rollback=b,this}});return g.requestFrame=e.requestFrame,g.releaseFrame=e.releaseFrame,g}},_p[9]={value:function(){var a=_p.r(0),b=_p.r(11).createClass("TranslateAnimator",{base:a,constructor:function(a,b){this.callBase({x:0,y:0},{x:a,y:b},function(a,b,c){var d=c.getDelta();a.translate(d.x,d.y)})}}),c=_p.r(61);return _p.r(11).extendClass(c,{fxTranslate:function(a,c,d,e,f,g){return this.animate(new b(a,c),d,e,f,g)}}),b}},_p[10]={value:function(){var a=function(){var a,b=navigator.userAgent.toLowerCase(),c=window.opera;a={ie:/(msie\s|trident.*rv:)([\w.]+)/.test(b),opera:!!c&&c.version,webkit:b.indexOf(" applewebkit/")>-1,mac:b.indexOf("macintosh")>-1},a.gecko="Gecko"==navigator.product&&!a.webkit&&!a.opera&&!a.ie;var d=0;if(a.ie&&(d=1*(b.match(/(msie\s|trident.*rv:)([\w.]+)/)[2]||0),a.ie11Compat=11==document.documentMode,a.ie9Compat=9==document.documentMode),a.gecko){var e=b.match(/rv:([\d\.]+)/);e&&(e=e[1].split("."),d=1e4*e[0]+100*(e[1]||0)+1*(e[2]||0))}return/chrome\/(\d+\.\d)/i.test(b)&&(a.chrome=+RegExp.$1),/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(b)&&!/chrome/i.test(b)&&(a.safari=+(RegExp.$1||RegExp.$2)),a.opera&&(d=parseFloat(c.version())),a.webkit&&(d=parseFloat(b.match(/ applewebkit\/(\d+)/)[1])),a.version=d,a.isCompatible=!a.mobile&&(a.ie&&d>=6||a.gecko&&d>=10801||a.opera&&d>=9.5||a.air&&d>=1||a.webkit&&d>=522||!1),a}();return a}},_p[11]={value:function(require,exports){function Class(){}function checkBaseConstructorCall(a,b){var c=a.toString();if(!/this\.callBase/.test(c))throw new Error(b+" : 类构造函数没有调用父类的构造函数!为了安全,请调用父类的构造函数")}function inherit(constructor,BaseClass,classname){var KityClass=eval("(function "+classname+"( __inherit__flag ) {if( __inherit__flag != KITY_INHERIT_FLAG ) {KityClass.__KityConstructor.apply(this, arguments);}this.__KityClassName = KityClass.__KityClassName;})");KityClass.__KityConstructor=constructor,KityClass.prototype=new BaseClass(KITY_INHERIT_FLAG);for(var methodName in BaseClass.prototype)BaseClass.prototype.hasOwnProperty(methodName)&&0!==methodName.indexOf("__Kity")&&(KityClass.prototype[methodName]=BaseClass.prototype[methodName]);return KityClass.prototype.constructor=KityClass,KityClass}function mixin(a,b){if(!1==b instanceof Array)return a;var c,d,e,f=b.length;for(a.__KityMixins={constructor:[]},c=0;f>c;c++){d=b[c].prototype;for(e in d)!1!==d.hasOwnProperty(e)&&0!==e.indexOf("__Kity")&&("constructor"===e?a.__KityMixins.constructor.push(d[e]):a.prototype[e]=a.__KityMixins[e]=d[e])}return a}function extend(a,b){b.__KityClassName&&(b=b.prototype);for(var c in b)if(b.hasOwnProperty(c)&&c.indexOf("__Kity")&&"constructor"!=c){var d=a.prototype[c]=b[c];d.__KityMethodClass=a,d.__KityMethodName=c}return a}Function.prototype.bind=Function.prototype.bind||function(a){var b=Array.prototype.slice.call(arguments,1);return this.apply(a,b)},exports.Class=Class,Class.__KityClassName="Class",Class.prototype.base=function(a){var b=arguments.callee.caller,c=b.__KityMethodClass.__KityBaseClass.prototype[a];return c.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callBase=function(){var a=arguments.callee.caller,b=a.__KityMethodClass.__KityBaseClass.prototype[a.__KityMethodName];return b.apply(this,arguments)},Class.prototype.mixin=function(a){var b=arguments.callee.caller,c=b.__KityMethodClass.__KityMixins;if(!c)return this;var d=c[a];return d.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callMixin=function(){var a=arguments.callee.caller,b=a.__KityMethodName,c=a.__KityMethodClass.__KityMixins;if(!c)return this;var d=c[b];if("constructor"==b){for(var e=0,f=d.length;f>e;e++)d[e].call(this);return this}return d.apply(this,arguments)},Class.prototype.pipe=function(a){return"function"==typeof a&&a.call(this,this),this},Class.prototype.getType=function(){return this.__KityClassName},Class.prototype.getClass=function(){return this.constructor};var KITY_INHERIT_FLAG="__KITY_INHERIT_FLAG_"+ +new Date;exports.createClass=function(a,b){var c,d,e;return 1===arguments.length&&(b=arguments[0],a="AnonymousClass"),e=b.base||Class,b.hasOwnProperty("constructor")?(c=b.constructor,e!=Class&&checkBaseConstructorCall(c,a)):c=function(){this.callBase.apply(this,arguments),this.callMixin.apply(this,arguments)},d=inherit(c,e,a),d=mixin(d,b.mixins),d.__KityClassName=c.__KityClassName=a,d.__KityBaseClass=c.__KityBaseClass=e,d.__KityMethodName=c.__KityMethodName="constructor",d.__KityMethodClass=c.__KityMethodClass=d,delete b.mixins,delete b.constructor,delete b.base,d=extend(d,b)},exports.extendClass=extend}},_p[12]={value:function(){var a={each:function(a,b,c){if(null!==a)if(a.length===+a.length){for(var d=0,e=a.length;e>d;d++)if(b.call(c,a[d],d,a)===!1)return!1}else for(var f in a)if(a.hasOwnProperty(f)&&b.call(c,a[f],f,a)===!1)return!1},extend:function(a){for(var b=arguments,c=this.isBoolean(b[b.length-1])?b[b.length-1]:!1,d=this.isBoolean(b[b.length-1])?b.length-1:b.length,e=1;d>e;e++){var f=b[e];for(var g in f)c&&a.hasOwnProperty(g)||(a[g]=f[g])}return a},deepExtend:function(a){for(var b=arguments,c=this.isBoolean(b[b.length-1])?b[b.length-1]:!1,d=this.isBoolean(b[b.length-1])?b.length-1:b.length,e=1;d>e;e++){var f=b[e];for(var g in f)c&&a.hasOwnProperty(g)||(this.isObject(a[g])&&this.isObject(f[g])?this.deepExtend(a[g],f[g],c):a[g]=f[g])}return a},clone:function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},copy:function(a){return"object"!=typeof a?a:"function"==typeof a?null:JSON.parse(JSON.stringify(a))},queryPath:function(a,b){for(var c=a.split("."),d=0,e=b,f=c.length;f>d;){if(!(c[d]in e))return void 0;if(e=e[c[d]],d++,d>=f||void 0===e)return e}},getValue:function(a,b){return void 0!==a?a:b},flatten:function(b){var c,d=[],e=b.length;for(c=0;e>c;c++)b[c]instanceof Array?d=d.concat(a.flatten(b[c])):d.push(b[c]);return d},paralle:function(b,c,d){var e,f,g,h;if(b instanceof Array){for(h=[],f=0;fg;g++)b[5*g+3]=f[g]/255;return b[18]=a.get("a"),this.colorMatrixEffect.set("values",b.join(" ")),this},setOpacity:function(a){var b=this.colorMatrixEffect.get("values").split(" ");return b[18]=a,this.colorMatrixEffect.set("values",b.join(" ")),this},setOffset:function(a,b){this.setOffsetX(a),this.setOffsetY(b)},setOffsetX:function(a){this.offsetEffect.set("dx",a)},setOffsetY:function(a){this.offsetEffect.set("dy",a)},setDeviation:function(a){this.gaussianblurEffect.set("stdDeviation",a)}})}},_p[23]={value:function(){return _p.r(11).createClass("Bezier",{mixins:[_p.r(52)],base:_p.r(47),constructor:function(a){this.callBase(),a=a||[],this.changeable=!0,this.setBezierPoints(a)},getBezierPoints:function(){return this.getPoints()},setBezierPoints:function(a){return this.setPoints(a)},onContainerChanged:function(){this.changeable&&this.update()},update:function(){var a=null,b=this.getBezierPoints();if(!(b.length<2)){a=this.getDrawer(),a.clear();var c=b[0].getVertex(),d=null,e=null;a.moveTo(c.x,c.y);for(var f=1,g=b.length;g>f;f++)c=b[f].getVertex(),e=b[f].getBackward(),d=b[f-1].getForward(),a.bezierTo(d.x,d.y,e.x,e.y,c.x,c.y);return this}}})}},_p[24]={value:function(){var a=_p.r(64),b=_p.r(74),c=_p.r(11).createClass("BezierPoint",{constructor:function(b,c,d){this.vertex=new a(b,c),this.forward=new a(b,c),this.backward=new a(b,c),this.setSmooth(void 0===d||d),this.setSymReflaction(!0)},clone:function(){var a=new c,b=null;return b=this.getVertex(),a.setVertex(b.x,b.y),b=this.getForward(),a.setForward(b.x,b.y),b=this.getBackward(),a.setBackward(b.x,b.y),a.setSymReflaction(this.isSymReflaction),a.setSmooth(this.isSmooth()),a},setVertex:function(a,b){return this.vertex.setPoint(a,b),this.update(),this},moveTo:function(a,b){var c=this.forward.getPoint(),d=this.backward.getPoint(),e=this.vertex.getPoint(),f={left:a-e.x,top:b-e.y};this.forward.setPoint(c.x+f.left,c.y+f.top),this.backward.setPoint(d.x+f.left,d.y+f.top),this.vertex.setPoint(a,b),this.update()},setForward:function(a,b){return this.forward.setPoint(a,b),this.smooth&&this.updateAnother(this.forward,this.backward),this.update(),this.lastControlPointSet=this.forward,this},setBackward:function(a,b){return this.backward.setPoint(a,b),this.smooth&&this.updateAnother(this.backward,this.forward),this.update(),this.lastControlPointSet=this.backward,this},setSymReflaction:function(a){return this.symReflaction=a,this.smooth&&this.setSmooth(!0),this},isSymReflaction:function(){return this.symReflaction},updateAnother:function(a,c){var d=this.getVertex(),e=b.fromPoints(a.getPoint(),d),f=b.fromPoints(d,c.getPoint());return f=e.normalize(this.isSymReflaction()?e.length():f.length()),c.setPoint(d.x+f.x,d.y+f.y),this},setSmooth:function(a){var b;return this.smooth=!!a,this.smooth&&(b=this.lastControlPointSet)&&this.updateAnother(b,b==this.forward?this.backward:this.forward),this},isSmooth:function(){return this.smooth},getVertex:function(){return this.vertex.getPoint()},getForward:function(){return this.forward.getPoint()},getBackward:function(){return this.backward.getPoint()},update:function(){return this.container?void(this.container.update&&this.container.update(this)):this}});return c}},_p[25]={value:function(){var a=_p.r(11).createClass("Box",{constructor:function(a,b,c,d){var e=arguments[0];e&&"object"==typeof e&&(a=e.x,b=e.y,c=e.width,d=e.height),0>c&&(a-=c=-c),0>d&&(b-=d=-d),this.x=a||0,this.y=b||0,this.width=c||0,this.height=d||0,this.left=this.x,this.right=this.x+this.width,this.top=this.y,this.bottom=this.y+this.height,this.cx=this.x+this.width/2,this.cy=this.y+this.height/2},getRangeX:function(){return[this.left,this.right]},getRangeY:function(){return[this.top,this.bottom]},merge:function(b){var c=Math.min(this.left,b.left),d=Math.max(this.right,b.right),e=Math.min(this.top,b.top),f=Math.max(this.bottom,b.bottom);return new a(c,e,d-c,f-e)},expand:function(b,c,d,e){if(arguments.length<1)return new a(this);arguments.length<2&&(c=b),arguments.length<3&&(d=b),arguments.length<4&&(e=c);var f=this.left-e,g=this.top-b,h=this.width+c,i=this.height+b;return new a(f,g,h,i)},valueOf:function(){return[this.x,this.y,this.width,this.height]},toString:function(){return this.valueOf().join(" ")}});return a.parse=function(b){return"string"==typeof b?a.parse(b.split(/[\s,]+/).map(parseFloat)):b instanceof Array?new a(b[0],b[1],b[2],b[3]):"x"in b?new a(b):null},a}},_p[26]={value:function(){return _p.r(11).createClass("Circle",{base:_p.r(33),constructor:function(a,b,c){this.callBase(a,a,b,c)},getRadius:function(){return this.getRadiusX()},setRadius:function(a){return this.callBase(a,a)}})}},_p[27]={value:function(){var a=_p.r(11),b=_p.r(61),c=a.createClass("Clip",{base:b,mixins:[_p.r(62)],constructor:function(){this.callBase("clipPath")},clip:function(a){return a.getNode().setAttribute("clip-path","url(#"+this.getId()+")"),this}});return a.extendClass(b,{clipWith:function(a){return a.clip(this),this}}),c}},_p[28]={value:function(){var a=_p.r(12),b=_p.r(65),c={},d=_p.r(11).createClass("Color",{constructor:function(){var b=null;"string"==typeof arguments[0]?(b=c.parseToValue(arguments[0]),null===b&&(b={r:0,g:0,b:0,h:0,s:0,l:0,a:1})):(b={r:0|arguments[0],g:0|arguments[1],b:0|arguments[2],a:parseFloat(arguments[3])||1},b=c.overflowFormat(b),b=a.extend(b,c.rgbValueToHslValue(b))),this._color=b},set:function(b,e){if(!d._MAX_VALUE[b])throw new Error("Color set(): Illegal parameter");return"a"!==b&&(e=Math.floor(e)),"h"==b&&(e=(e+360)%360),this._color[b]=Math.max(d._MIN_VALUE[b],Math.min(d._MAX_VALUE[b],e)),-1!=="rgb".indexOf(b)?this._color=a.extend(this._color,c.rgbValueToHslValue(this._color)):-1!=="hsl".indexOf(b)&&(this._color=a.extend(this._color,c.hslValueToRGBValue(this._color))),this},inc:function(a,b){return b=this.get(a)+b,"h"==a?b=(b+360)%360:(b=Math.min(d._MAX_VALUE[a],b),b=Math.max(d._MIN_VALUE[a],b)),this.clone().set(a,b)},dec:function(a,b){return this.inc(a,-b)},clone:function(){return new d(this.toRGBA())},get:function(a){return d._MAX_VALUE[a]?this._color[a]:null},getValues:function(){return a.clone(this._color)},valueOf:function(){return this.getValues()},toRGB:function(){return c.toString(this._color,"rgb")},toRGBA:function(){return c.toString(this._color,"rgba")},toHEX:function(){return c.toString(this._color,"hex")},toHSL:function(){return c.toString(this._color,"hsl")},toHSLA:function(){return c.toString(this._color,"hsla")},toString:function(){return 1===this._color.a?this.toRGB():this.toRGBA()}});return a.extend(d,{_MAX_VALUE:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},_MIN_VALUE:{r:0,g:0,b:0,h:0,s:0,l:0,a:0},R:"r",G:"g",B:"b",H:"h",S:"s",L:"l",A:"a",parse:function(b){var e;return a.isString(b)&&(e=c.parseToValue(b)),a.isObject(b)&&"r"in b&&(e=b),null===e?new d:new d(e.r,e.g,e.b,e.a)},createHSL:function(a,b,c){return d.createHSLA(a,b,c,1)},createHSLA:function(a,b,c,e){var f=null;return b+="%",c+="%",f=["hsla("+a,b,c,e+")"],d.parse(f.join(", "))},createRGB:function(a,b,c){return d.createRGBA(a,b,c,1)},createRGBA:function(a,b,c,e){return new d(a,b,c,e)}}),a.extend(c,{parseToValue:function(a){var d={};if(a=b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a]||a,/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(a))d=c.hexToValue(a);else if(/^(rgba?)/i.test(a))d=c.rgbaToValue(a);else{if(!/^(hsla?)/i.test(a))return null;d=c.hslaToValue(a)}return c.overflowFormat(d)},hexToValue:function(b){var d={},e=["r","g","b"];return/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(b)?(b=RegExp.$1.split(""),a.each(e,function(a,e){d[a]=c.toNumber(3===b.length?b[e]+b[e]:b[2*e]+b[2*e+1])}),d=a.extend(d,c.rgbValueToHslValue(d)),d.a=1,d):null},rgbaToValue:function(b){var d={},e=!1,f=["r","g","b"];return/^(rgba?)/i.test(b)?(e=4===RegExp.$1.length,b=b.replace(/^rgba?/i,"").replace(/\s+/g,"").replace(/[^0-9,.]/g,"").split(","),a.each(f,function(a,c){d[a]=0|b[c]}),d=a.extend(d,c.rgbValueToHslValue(d)),d.a=e?parseFloat(b[3]):1,d):null},hslaToValue:function(b){var d={},e=!1;return/^(hsla?)/i.test(b)?(e=4===RegExp.$1.length,b=b.replace(/^hsla?/i,"").replace(/\s+/g,"").replace(/[^0-9,.]/g,"").split(","),d.h=0|b[0],d.s=0|b[1],d.l=0|b[2],d=a.extend(d,c.hslValueToRGBValue(d)),d=c.hslValueToRGBValue(d),d.a=e?parseFloat(b[3]):1,d):null},hslValueToRGBValue:function(b){function c(a,b,c){return 0>c?c+=1:c>1&&(c-=1),1>6*c?a+6*(b-a)*c:1>2*c?b:2>3*c?a+6*(b-a)*(2/3-c):a}var d=null,e=null,f={};return b=a.extend({},b),b.h=b.h/360,b.s=b.s/100,b.l=b.l/100,0===b.s?f.r=f.g=f.b=b.l:(d=b.l<.5?b.l*(1+b.s):b.l+b.s-b.l*b.s,e=2*b.l-d,f.r=c(e,d,b.h+1/3),f.g=c(e,d,b.h),f.b=c(e,d,b.h-1/3)),f.r=Math.min(Math.round(255*f.r),255),f.g=Math.min(Math.round(255*f.g),255),f.b=Math.min(Math.round(255*f.b),255),f},rgbValueToHslValue:function(b){var c=null,d=null,e={};return b=a.extend({},b),b.r=b.r/255,b.g=b.g/255,b.b=b.b/255,c=Math.max(b.r,b.g,b.b),d=Math.min(b.r,b.g,b.b),c===d?e.h=0:c===b.r?e.h=b.g>=b.b?60*(b.g-b.b)/(c-d):60*(b.g-b.b)/(c-d)+360:c===b.g?e.h=60*(b.b-b.r)/(c-d)+120:c===b.b&&(e.h=60*(b.r-b.g)/(c-d)+240),e.l=(c+d)/2,e.s=0===e.l||c===d?0:e.l>0&&e.l<=.5?(c-d)/(c+d):(c-d)/(2-c-d),e.h=Math.round(e.h),e.s=Math.round(100*e.s),e.l=Math.round(100*e.l),e},toString:function(b,d){var e=[];return b=a.extend({},b),-1!==d.indexOf("hsl")&&(b.s+="%",b.l+="%"),"hex"!==d?(a.each(d.split(""),function(a){e.push(b[a])}),(d+"("+e.join(", ")+")").toLowerCase()):(e.push(c.toHexValue(+b.r)),e.push(c.toHexValue(+b.g)),e.push(c.toHexValue(+b.b)),("#"+e.join("")).toLowerCase()) +},toNumber:function(a){return 0|Number("0x"+a)},toHexValue:function(a){var b=a.toString(16);return 1===b.length?"0"+b:b},overflowFormat:function(b){var c=a.extend({},b),e="rgba";return a.each(e.split(""),function(a){c.hasOwnProperty(a)&&(c[a]=Math.min(d._MAX_VALUE[a],c[a]),c[a]=Math.max(d._MIN_VALUE[a],c[a]))}),c}}),d}},_p[29]={value:function(){function a(){return this.container.removeItem(this),this}return _p.r(11).createClass("Container",{getItems:function(){return this.items||(this.items=[])},getItem:function(a){return this.getItems()[a]},getFirstItem:function(){return this.getItem(0)},getLastItem:function(){return this.getItem(this.getItems().length-1)},indexOf:function(a){return this.getItems().indexOf(a)},eachItem:function(a){var b,c=this.getItems(),d=c.length;for(b=0;d>b;b++)a.call(this,b,c[b]);return this},addItem:function(b,c,d){var e=this.getItems(),f=e.length;return~e.indexOf(b)?this:(c>=0&&f>c||(c=f),e.splice(c,0,b),"object"==typeof b&&(b.container=this,b.remove=a),this.handleAdd(b,c),d||this.onContainerChanged("add",[b]),this)},addItems:function(a){for(var b=0,c=a.length;c>b;b++)this.addItem(a[b],-1,!0);return this.onContainerChanged("add",a),this},setItems:function(a){return this.clear().addItems(a)},appendItem:function(a){return this.addItem(a)},prependItem:function(a){return this.addItem(a,0)},removeItem:function(a,b){if("number"!=typeof a)return this.removeItem(this.indexOf(a));var c=this.getItems(),d=(c.length,c[a]);return void 0===d?this:(c.splice(a,1),d.container&&delete d.container,d.remove&&delete d.remove,this.handleRemove(d,a),b||this.onContainerChanged("remove",[d]),this)},clear:function(){for(var a,b=[];a=this.getFirstItem();)b.push(a),this.removeItem(0,!0);return this.onContainerChanged("remove",b),this},onContainerChanged:function(){},handleAdd:function(){},handleRemove:function(){}})}},_p[30]={value:function(){var a=_p.r(12),b={getCurvePanLines:function(a,c){var d=b.getCenterPoints(a),e=b.getPanLine(a.length,d);return b.getMovedPanLines(a,e,c)},getCenterPoints:function(a){for(var b={},c=null,d=0,e=0,f=a.length;f>d;d++)e=d===f-1?0:d+1,c=d+","+e,b[c]={x:(a[d].x+a[e].y)/2,y:(a[d].x+a[e].y)/2};return b},getPanLine:function(a,b){for(var c,d={},e=null,f=0;a>f;f++){var g=null,h=null;c=(f+1)%a,e=c,g=b[f+","+c],f=c,c=(f+1)%a,h=b[f+","+c],d[e]={points:[{x:g.x,y:g.y},{x:h.x,y:h.y}],center:{x:(g.x+h.x)/2,y:(g.y+h.y)/2}},f=(e+a-1)%a}return d},getMovedPanLines:function(b,c,d){var e={};return a.each(b,function(b,f){var g=c[f],h=g.center,i={x:h.x-b.x,y:h.y-b.y},j=e[f]={points:[],center:{x:b.x,y:b.y}};a.each(g.points,function(a){var b={x:a.x-i.x,y:a.y-i.y},c=j.center,e=b.x-c.x,f=b.y-c.y;b.x=c.x+d*e,b.y=c.y+d*f,j.points.push(b)})}),e}};return _p.r(11).createClass("Curve",{base:_p.r(47),mixins:[_p.r(52)],constructor:function(a,b){this.callBase(),this.setPoints(a||[]),this.closeState=!!b,this.changeable=!0,this.smoothFactor=1,this.update()},onContainerChanged:function(){this.changeable&&this.update()},setSmoothFactor:function(a){return this.smoothFactor=0>a?0:a,this.update(),this},getSmoothFactor:function(){return this.smoothFactor},update:function(){var a=this.getPoints(),c=null,d=this.getDrawer(),e=null,f=null,g=null;if(d.clear(),0===a.length)return this;if(d.moveTo(a[0]),1===a.length)return this;if(2===a.length)return d.lineTo(a[1]),this;c=b.getCurvePanLines(a,this.getSmoothFactor());for(var h=1,i=a.length;i>h;h++)e=c[h].center,f=this.closeState||h!=i-1?c[h].points[0]:c[h].center,g=this.closeState||1!=h?c[h-1].points[1]:c[h-1].center,d.bezierTo(g.x,g.y,f.x,f.y,e.x,e.y);return this.closeState&&(e=c[0].center,f=c[0].points[0],g=c[a.length-1].points[1],d.bezierTo(g.x,g.y,f.x,f.y,e.x,e.y)),this},close:function(){return this.closeState=!0,this.update()},open:function(){return this.closeState=!1,this.update()},isClose:function(){return!!this.closeState}})}},_p[31]={value:function(){return _p.r(11).createClass("Data",{constructor:function(){this._data={}},setData:function(a,b){return this._data[a]=b,this},getData:function(a){return this._data[a]},removeData:function(a){return delete this._data[a],this}})}},_p[32]={value:function(){return _p.r(11).createClass("GradientBrush",{base:_p.r(59),constructor:function(a){this.callBase(a)}})}},_p[33]={value:function(){var a=(_p.r(12),_p.r(51));return _p.r(11).createClass("Ellipse",{base:_p.r(47),constructor:function(a,b,c,d){this.callBase(),this.rx=a||0,this.ry=b||0,this.cx=c||0,this.cy=d||0,this.update()},update:function(){var a=this.rx,b=this.ry,c=this.cx+a,d=this.cx-a,e=this.cy,f=this.getDrawer();return f.clear(),f.moveTo(c,e),f.arcTo(a,b,0,1,1,d,e),f.arcTo(a,b,0,1,1,c,e),this},getRadius:function(){return{x:this.rx,y:this.ry}},getRadiusX:function(){return this.rx},getRadiusY:function(){return this.ry},getCenter:function(){return new a(this.cx,this.cy)},getCenterX:function(){return this.cx},getCenterY:function(){return this.cy},setRadius:function(a,b){return this.rx=a,this.ry=b,this.update()},setRadiusX:function(a){return this.rx=a,this.update()},setRadiusY:function(a){return this.ry=a,this.update()},setCenter:function(b,c){if(1==arguments.length){var d=a.parse(arguments[0]);b=d.x,c=d.y}return this.cx=b,this.cy=c,this.update()},setCenterX:function(a){return this.cx=a,this.update()},setCenterY:function(a){return this.cy=a,this.update()}})}},_p[34]={value:function(){function a(a,b,d){return d=!!d,h.isString(a)&&(a=a.match(/\S+/g)),h.each(a,function(a){c.call(this,this.node,a,b,d)},this),this}function b(a,b){var c=null,d=this._EVNET_UID,f=void 0===b;try{c=k[d][a]}catch(g){return}return f||(f=!0,h.each(c,function(a,d){a===b?delete c[d]:f=!1})),f&&(e(this.node,a,j[d][a]),delete k[d][a],delete j[d][a]),this}function c(a,b,c,e){var f=this._EVNET_UID,g=this;j[f]||(j[f]={}),j[f][b]||(j[f][b]=function(a){a=new i(a||window.event),h.each(k[f][b],function(c){var d;return c&&(d=c.call(g,a),e&&g.off(b,c)),d},g)}),k[f]||(k[f]={}),k[f][b]?k[f][b].push(c):(k[f][b]=[c],a&&d(a,b,j[f][b]))}function d(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)}function e(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent(b,c)}function f(a,b,c){var d=new CustomEvent(b,{bubbles:!0,cancelable:!0});d._kityParam=c,a.dispatchEvent(d)}function g(a,b,c){var d=null,e=null;try{if(e=j[a._EVNET_UID][b],!e)return}catch(f){return}d=h.extend({type:b,target:a},c||{}),e.call(a,d)}!function(){function a(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}a.prototype=window.Event.prototype,window.CustomEvent=a}();var h=_p.r(12),i=_p.r(63),j={},k={},l=0;return _p.r(11).createClass("EventHandler",{constructor:function(){this._EVNET_UID=++l},addEventListener:function(b,c){return a.call(this,b,c,!1)},addOnceEventListener:function(b,c){return a.call(this,b,c,!0)},removeEventListener:function(a,c){return b.call(this,a,c)},on:function(){return this.addEventListener.apply(this,arguments)},once:function(){return this.addOnceEventListener.apply(this,arguments)},off:function(){return this.removeEventListener.apply(this,arguments)},fire:function(){return this.trigger.apply(this,arguments)},trigger:function(a,b){return this.node?f(this.node,a,b):g(this,a,b),this}})}},_p[35]={value:function(){function a(a){var b,c,d,e,f;for(b=[],c=0;cc;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function e(){var f=Array.prototype.slice.call(arguments,0),g=f.join("␀"),h=e.cache=e.cache||{},i=e.count=e.count||[];return h.hasOwnProperty(g)?(d(i,g),c?c(h[g]):h[g]):(i.length>=1e3&&delete h[i.shift()],i.push(g),h[g]=a.apply(b,f),c?c(h[g]):h[g])}return e}function c(a,b,d,e,f,g,h,i,j,k){var l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q=Math,R=Q.PI,S=Math.abs,T=120*R/180,U=R/180*(+f||0),V=[],W=function(a,b,c){var d=a*Q.cos(c)-b*Q.sin(c),e=a*Q.sin(c)+b*Q.cos(c);return{x:d,y:e}};if(k?(w=k[0],x=k[1],u=k[2],v=k[3]):(l=W(a,b,-U),a=l.x,b=l.y,l=W(i,j,-U),i=l.x,j=l.y,m=Q.cos(R/180*f),n=Q.sin(R/180*f),p=(a-i)/2,q=(b-j)/2,o=p*p/(d*d)+q*q/(e*e),o>1&&(o=Q.sqrt(o),d=o*d,e=o*e),r=d*d,s=e*e,t=(g==h?-1:1)*Q.sqrt(S((r*s-r*q*q-s*p*p)/(r*q*q+s*p*p))),u=t*d*q/e+(a+i)/2,v=t*-e*p/d+(b+j)/2,w=Q.asin(((b-v)/e).toFixed(9)),x=Q.asin(((j-v)/e).toFixed(9)),w=u>a?R-w:w,x=u>i?R-x:x,0>w&&(w=2*R+w),0>x&&(x=2*R+x),h&&w>x&&(w-=2*R),!h&&x>w&&(x-=2*R)),y=x-w,S(y)>T&&(z=x,A=i,B=j,x=w+T*(h&&x>w?1:-1),i=u+d*Q.cos(x),j=v+e*Q.sin(x),V=c(i,j,d,e,f,0,h,A,B,[x,z,u,v])),y=x-w,C=Q.cos(w),D=Q.sin(w),E=Q.cos(x),F=Q.sin(x),G=Q.tan(y/4),H=4/3*d*G,I=4/3*e*G,J=[a,b],K=[a+H*D,b-I*C],L=[i+H*F,j-I*E],M=[i,j],K[0]=2*J[0]-K[0],K[1]=2*J[1]-K[1],k)return[K,L,M].concat(V);for(V=[K,L,M].concat(V).join().split(","),N=[],O=0,P=V.length;P>O;O++)N[O]=O%2?W(V[O-1],V[O],U).y:W(V[O],V[O+1],U).x;return N}function d(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]}function e(a,b){function c(a){return function(b,c){return b+a*(c-b)}}var d=c(b||.5),e=a,f=e[0],g=e[1],h=e[2],i=e[3],j=e[4],k=e[5],l=e[6],m=e[7],n=d(f,h),o=d(g,i),p=d(h,j),q=d(i,k),r=d(j,l),s=d(k,m),t=d(n,p),u=d(o,q),v=d(p,r),w=d(q,s),x=d(t,v),y=d(u,w);return[[f,g,n,o,t,u,x,y],[x,y,v,w,r,s,l,m]]}var f=_p.r(12),g=_p.r(51),h=_p.r(74),i=_p.r(44),j={},k=/([achlmrqstvz])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?\s*)+)/gi,l=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)\s*,?\s*/gi,m={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0};j.pathToString=function(a){return a=a||this,"string"==typeof a?a:a instanceof Array?(a=f.flatten(a),a.join(",").replace(/,?([achlmqrstvxz]),?/gi,"$1")):void 0},j.parsePathString=b(function(a){var b=[];return a.replace(k,function(a,c,d){var e=[],f=c.toLowerCase();if(d.replace(l,function(a,b){b&&e.push(+b)}),"m"==f&&e.length>2&&(b.push([c].concat(e.splice(0,2))),f="l",c="m"==c?"l":"L"),"r"==f)b.push([c].concat(e));else for(;e.length>=m[f]&&(b.push([c].concat(e.splice(0,m[f]))),m[f]););}),b.isUniform=!0,b.toString=j.pathToString,b}),j.pathToAbsolute=b(function(a){var b,c,d,e,f,g,h,i,k=a.isUniform?a:j.parsePathString(j.pathToString(a)),l=[],m=0,n=0,o=0,p=0,q=0;for("M"==k[0][0]&&(m=+k[0][1],n=+k[0][2],o=m,p=n,q++,l[0]=["M",m,n]),d=q,g=k.length;g>d;d++){if(l.push(b=[]),c=k[d],c[0]!=c[0].toUpperCase())switch(b[0]=c[0].toUpperCase(),b[0]){case"A":b[1]=c[1],b[2]=c[2],b[3]=c[3],b[4]=c[4],b[5]=c[5],b[6]=+(c[6]+m),b[7]=+(c[7]+n);break;case"V":b[1]=+c[1]+n;break;case"H":b[1]=+c[1]+m;break;case"M":o=+c[1]+m,p=+c[2]+n;break;default:for(e=1,h=c.length;h>e;e++)b[e]=+c[e]+(e%2?m:n)}else for(f=0,i=c.length;i>f;f++)b[f]=c[f];switch(b[0]){case"Z":m=o,n=p;break;case"H":m=b[1];break;case"V":n=b[1];break;case"M":o=b[b.length-2],p=b[b.length-1];break;default:m=b[b.length-2],n=b[b.length-1]}}return l.isUniform=!0,l.isAbsolute=!0,l.toString=j.pathToString,l}),j.pathToCurve=b(function(a){var b,e,f,g,h,i,k,l,m,n,o,p,q=[];for(a.isAbsolute||(a=j.pathToAbsolute(a)),b=0;bb&&(b=0),Math.pow(b,.5)}var c,d,e,f,g,h,i,j,k,l,m,n=a;return c=-3*n[0]+9*n[2]-9*n[4]+3*n[6],d=6*n[0]-12*n[2]+6*n[4],e=-3*n[0]+3*n[2],f=-3*n[1]+9*n[3]-9*n[5]+3*n[7],g=6*n[1]-12*n[3]+6*n[5],h=-3*n[1]+3*n[3],i=Math.pow(c,2)+Math.pow(f,2),j=2*(c*d+f*g),k=2*(c*e+f*h)+Math.pow(d,2)+Math.pow(g,2),l=2*(d*e+g*h),m=Math.pow(e,2)+Math.pow(h,2),(b(0)+b(1)+4*(b(.125)+b(.375)+b(.625)+b(.875))+2*(b(.25)+b(.5)+b(.75)))/24});var n=b(function(a){var b,c,d,e,f,g,h;for(g=[],h=0,b=0,c=a.length;c>b;b++)d=a[b],"M"!=d[0]?"Z"!=d[0]?(f=j.bezierLength(e.concat(d.slice(1))),g.push([h,h+f]),h+=f,e=d.slice(4)):g.push(null):(e=d.slice(1),g.push(null));return g.totalLength=h,g});j.subPath=function(a,b,c){var d;if(c=c||0,d=b-c,d-=0|d,c-=0|c,b=c+d,b>1)return j.subPath(a,1,c).concat(j.subPath(a,b-1));a.isCurve||(a=j.pathToCurve(a));var e,f,g,h,i,k,l,m,o,p=n(a),q=p.totalLength,r=q*b,s=q*(c||0),t=[];for(e=0,f=a.length;f>e;e++)if("M"!=a[e][0]){if("Z"!=a[e][0])if(g=p[e][0],h=p[e][1],i=h-g,l=k.concat(a[e].slice(1)),s>h)k=l.slice(l.length-2);else{if(s>=g)m=j.subBezier(l,Math.min((r-g)/i,1),(s-g)/i),o=!0,k=m.slice(0,2),t.push(["M"].concat(m.slice(0,2))),t.push(["C"].concat(m.slice(2)));else if(r>=h)t.push(a[e].slice());else{if(!(r>=g))break;m=j.subBezier(l,(r-g)/i),t.push(["C"].concat(m.slice(2))),o=!1}k=l.slice(l.length-2)}}else k=a[e].slice(1),o&&t.push(a[e].slice());return t.isAbsolute=!0,t.isCurve=!0,t.isUniform=!0,t.toString=j.pathToString,t},j.pointAtPath=function(a,b){a.isCurve||(a=j.pathToCurve(a));var c=j.subPath(a,b),d="Z"==c[c.length-1][0]?c[c.length-2]:c[c.length-1];d=d.slice(1);var e=g.parse(d.slice(4)),f=g.parse(d.slice(2,4));return e.tan=h.fromPoints(f,e).normalize(),e},j.pathLength=b(function(a){a.isCurve||(a=j.pathToCurve(a));var b=n(a);return b.totalLength}),j.pathKeyPoints=b(function(a){var b,c,d;for(a.isCurve||(a=j.pathToCurve(a)),d=[],b=0,c=a.length;c>b;b++)"z"!=a[b][0]&&d.push(a[b].slice(a[b].length-2));return d});var o=b(function(b,c){function d(a,b){return a[b||a.i]&&a[b||a.i][0]}function e(a,b){return a[b||a.i]&&a[b||a.i].slice(1)}function f(a,b){var c=e(a,b);return c&&c.slice(-2)}function g(a){return"Z"==d(a)?(a.splice(a.i,1),!0):!1}function h(a){return"M"==d(a)?(a.o.splice(a.o.i,0,["M"].concat(f(a.o,a.o.i-1))),a.i++,a.o.i++,!0):!1}function i(a){for(var b,c=1;!b;)b=f(a,a.length-c++);for(a.o.i=a.i;a.lengthc;c++)for(f.push(h=[a[c][0]]),e=1;ee&&f.setAttribute("stop-opacity",e),this.node.appendChild(f),this}})}},_p[37]={value:function(){var a=_p.r(62);return _p.r(11).createClass("Group",{mixins:[a],base:_p.r(61),constructor:function(){this.callBase("g")}})}},_p[38]={value:function(){var a=_p.r(62);return _p.r(11).createClass("HyperLink",{mixins:[a],base:_p.r(61),constructor:function(a){this.callBase("a"),this.setHref(a)},setHref:function(a){return this.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a),this},getHref:function(){return this.node.getAttributeNS("xlink:href")},setTarget:function(a){return this.node.setAttribute("target",a),this},getTarget:function(){return this.node.getAttribute("target")}})}},_p[39]={value:function(){return _p.r(11).createClass("Image",{base:_p.r(61),constructor:function(a,b,c,d,e){this.callBase("image"),this.url=a,this.width=b||0,this.height=c||0,this.x=d||0,this.y=e||0,this.update()},update:function(){return this.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",this.url),this.node.setAttribute("x",this.x),this.node.setAttribute("y",this.y),this.node.setAttribute("width",this.width),this.node.setAttribute("height",this.height),this},setUrl:function(a){return this.url=""===a?null:a,this.update()},getUrl:function(){return this.url},setWidth:function(a){return this.width=a,this.update()},getWidth:function(){return this.width},setHeight:function(a){return this.height=a,this.update()},getHeight:function(){return this.height},setX:function(a){return this.x=a,this.update()},getX:function(){return this.x},setY:function(a){return this.y=a,this.update()},getY:function(){return this.y}})}},_p[40]={value:function(){return _p.r(11).createClass("Line",{base:_p.r(47),constructor:function(a,b,c,d){this.callBase(),this.point1={x:a||0,y:b||0},this.point2={x:c||0,y:d||0},this.update()},setPoint1:function(a,b){return this.point1.x=a,this.point1.y=b,this.update()},setPoint2:function(a,b){return this.point2.x=a,this.point2.y=b,this.update()},getPoint1:function(){return{x:this.point1.x,y:this.point1.y}},getPoint2:function(){return{x:this.point2.x,y:this.point2.y}},update:function(){var a=this.getDrawer();return a.clear(),a.moveTo(this.point1.x,this.point1.y),a.lineTo(this.point2.x,this.point2.y),this}})}},_p[41]={value:function(){var a="LinearGradientBrush",b=(_p.r(68),_p.r(36));return _p.r(11).createClass(a,{base:b,constructor:function(a){this.callBase("linearGradient"),this.setStartPosition(0,0),this.setEndPosition(1,0),"function"==typeof a&&a.call(this,this)},setStartPosition:function(a,b){return this.node.setAttribute("x1",a),this.node.setAttribute("y1",b),this},setEndPosition:function(a,b){return this.node.setAttribute("x2",a),this.node.setAttribute("y2",b),this},getStartPosition:function(){return{x:+this.node.getAttribute("x1"),y:+this.node.getAttribute("y1")}},getEndPosition:function(){return{x:+this.node.getAttribute("x2"),y:+this.node.getAttribute("y2")}}})}},_p[42]={value:function(){var a=_p.r(51),b=_p.r(11).createClass("Marker",{base:_p.r(59),mixins:[_p.r(62),_p.r(76)],constructor:function(){this.callBase("marker"),this.setOrient("auto")},setRef:function(a,b){return 1===arguments.length&&(b=a.y,a=a.x),this.node.setAttribute("refX",a),this.node.setAttribute("refY",b),this},getRef:function(){return new a(+this.node.getAttribute("refX"),+this.node.getAttribute("refY"))},setWidth:function(a){return this.node.setAttribute("markerWidth",this.width=a),this},setOrient:function(a){return this.node.setAttribute("orient",this.orient=a),this},getOrient:function(){return this.orient},getWidth:function(){return+this.width},setHeight:function(a){return this.node.setAttribute("markerHeight",this.height=a),this},getHeight:function(){return+this.height}}),c=_p.r(47);return _p.r(11).extendClass(c,{setMarker:function(a,b){return b=b||"end",a?this.node.setAttribute("marker-"+b,a.toString()):this.node.removeAttribute("marker-"+b),this}}),b}},_p[43]={value:function(){var a=_p.r(11),b=_p.r(61),c=a.createClass("Mask",{base:b,mixins:[_p.r(62)],constructor:function(){this.callBase("mask")},mask:function(a){return a.getNode().setAttribute("mask","url(#"+this.getId()+")"),this}});return a.extendClass(b,{maskWith:function(a){return a.mask(this),this}}),c}},_p[44]={value:function(){function a(a,b){return{a:b.a*a.a+b.c*a.b,b:b.b*a.a+b.d*a.b,c:b.a*a.c+b.c*a.d,d:b.b*a.c+b.d*a.d,e:b.a*a.e+b.c*a.f+b.e,f:b.b*a.e+b.d*a.f+b.f}}function b(a){return a*Math.PI/180}var c=_p.r(12),d=_p.r(25),e=/matrix\((.+)\)/i,f=_p.r(51),g=_p.r(11).createClass("Matrix",{constructor:function(){arguments.length?this.setMatrix.apply(this,arguments):this.setMatrix(1,0,0,1,0,0)},translate:function(b,c){return this.m=a(this.m,{a:1,c:0,e:b,b:0,d:1,f:c}),this},rotate:function(c){var d=b(c),e=Math.sin(d),f=Math.cos(d);return this.m=a(this.m,{a:f,c:-e,e:0,b:e,d:f,f:0}),this},scale:function(b,c){return void 0===c&&(c=b),this.m=a(this.m,{a:b,c:0,e:0,b:0,d:c,f:0}),this},skew:function(c,d){void 0===d&&(d=c);var e=Math.tan(b(c)),f=Math.tan(b(d));return this.m=a(this.m,{a:1,c:e,e:0,b:f,d:1,f:0}),this},inverse:function(){var a,b,c,d,e,f,h,i=this.m,j=i.a,k=i.b,l=i.c,m=i.d,n=i.e,o=i.f;return a=j*m-k*l,b=m/a,c=-k/a,d=-l/a,e=j/a,f=(l*o-n*m)/a,h=(k*n-j*o)/a,new g(b,c,d,e,f,h)},setMatrix:function(a,b,d,e,f,g){return this.m=1===arguments.length?c.clone(arguments[0]):{a:a,b:b,c:d,d:e,e:f,f:g},this},getMatrix:function(){return c.clone(this.m)},getTranslate:function(){var a=this.m;return{x:a.e/a.a,y:a.f/a.d}},mergeMatrix:function(b){return new g(a(this.m,b.m))},merge:function(a){return this.mergeMatrix(a)},toString:function(){return this.valueOf().join(" ")},valueOf:function(){var a=this.m;return[a.a,a.b,a.c,a.d,a.e,a.f]},equals:function(a){var b=this.m,c=a.m;return b.a==c.a&&b.b==c.b&&b.c==c.c&&b.d==c.d&&b.e==c.e&&b.f==c.f},transformPoint:function(){return g.transformPoint.apply(null,[].slice.call(arguments).concat([this.m]))},transformBox:function(a){return g.transformBox(a,this.m)}});return g.parse=function(a){var b,c=parseFloat;if(a instanceof Array)return new g({a:a[0],b:a[1],c:a[2],d:a[3],e:a[4],f:a[5]});if(b=e.exec(a)){var d=b[1].split(",");return 6!=d.length&&(d=b[1].split(" ")),new g({a:c(d[0]),b:c(d[1]),c:c(d[2]),d:c(d[3]),e:c(d[4]),f:c(d[5])})}return new g},g.transformPoint=function(a,b,c){return 2===arguments.length&&(c=b,b=a.y,a=a.x),new f(c.a*a+c.c*b+c.e,c.b*a+c.d*b+c.f)},g.transformBox=function(a,b){for(var e,f,h=Number.MAX_VALUE,i=-Number.MAX_VALUE,j=Number.MAX_VALUE,k=-Number.MAX_VALUE,l=[[a.x,a.y],[a.x+a.width,a.y],[a.x,a.y+a.height],[a.x+a.width,a.y+a.height]],m=[];e=l.pop();)f=g.transformPoint(e[0],e[1],b),m.push(f),h=Math.min(h,f.x),i=Math.max(i,f.x),j=Math.min(j,f.y),k=Math.max(k,f.y);return a=new d({x:h,y:j,width:i-h,height:k-j}),c.extend(a,{closurePoints:m}),a},g.getCTM=function(a,b){var c={a:1,b:0,c:0,d:1,e:0,f:0},d=a.shapeNode||a.node;switch(b=b||"parent"){case"screen":c=d.getScreenCTM();break;case"doc":case"paper":c=d.getCTM();break;case"view":case"top":a.getPaper()&&(c=d.getTransformToElement(a.getPaper().shapeNode));break;case"parent":a.node.parentNode&&(c=d.getTransformToElement(a.node.parentNode));break;default:b.node&&(c=d.getTransformToElement(b.shapeNode||b.node))}return c?new g(c.a,c.b,c.c,c.d,c.e,c.f):new g},g}},_p[45]={value:function(){var a=_p.r(65),b=_p.r(28),c=_p.r(12),d=_p.r(11).createClass("Palette",{constructor:function(){this.color={}},get:function(c){var d=this.color[c]||a.EXTEND_STANDARD[c]||a.COLOR_STANDARD[c]||"";return d?new b(d):null},getColorValue:function(b){return this.color[b]||a.EXTEND_STANDARD[b]||a.COLOR_STANDARD[b]||""},add:function(a,c){return this.color[a]="string"==typeof c?new b(c).toRGBA():c.toRGBA(),c},remove:function(a){return this.color.hasOwnProperty(a)?(delete this.color[a],!0):!1}});return c.extend(d,{getColor:function(c){var d=a.EXTEND_STANDARD[c]||a.COLOR_STANDARD[c];return d?new b(d):null},getColorValue:function(b){return a.EXTEND_STANDARD[b]||a.COLOR_STANDARD[b]||""},addColor:function(c,d){return a.EXTEND_STANDARD[c]="string"==typeof d?new b(d).toRGBA():d.toRGBA(),d},removeColor:function(b){return a.EXTEND_STANDARD.hasOwnProperty(b)?(delete a.EXTEND_STANDARD[b],!0):!1}}),d}},_p[46]={value:function(){var a=_p.r(11),b=_p.r(12),c=_p.r(68),d=_p.r(29),e=_p.r(62),f=_p.r(76),g=_p.r(34),h=_p.r(67),i=_p.r(44),j=a.createClass("Paper",{mixins:[e,g,h,f],constructor:function(a){this.callBase(),this.node=this.createSVGNode(),this.node.paper=this,this.node.appendChild(this.resourceNode=c.createNode("defs")),this.node.appendChild(this.shapeNode=c.createNode("g")),this.resources=new d,this.setWidth("100%").setHeight("100%"),a&&this.renderTo(a),this.callMixin()},renderTo:function(a){b.isString(a)&&(a=document.getElementById(a)),this.container=a,a.appendChild(this.node)},createSVGNode:function(){var a=c.createNode("svg");return a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),a},getNode:function(){return this.node},getContainer:function(){return this.container},getWidth:function(){return this.node.clientWidth},setWidth:function(a){return this.node.setAttribute("width",a),this},getHeight:function(){return this.node.clientHeight},setHeight:function(a){return this.node.setAttribute("height",a),this},setViewPort:function(a,b,c){var d,e;1==arguments.length&&(d=arguments[0],a=d.center.x,b=d.center.y,c=d.zoom),c=c||1,e=this.getViewBox();var f=new i,g=e.x+e.width/2-a,h=e.y+e.height/2-b;return f.translate(-a,-b),f.scale(c),f.translate(a,b),f.translate(g,h),this.shapeNode.setAttribute("transform","matrix("+f+")"),this.viewport={center:{x:a,y:b},offset:{x:g,y:h},zoom:c},this},getViewPort:function(){if(!this.viewport){var a=this.getViewBox();return{zoom:1,center:{x:a.x+a.width/2,y:a.y+a.height/2},offset:{x:0,y:0}}}return this.viewport},getViewPortTransform:function(){var a=this.shapeNode.getCTM();return new i(a.a,a.b,a.c,a.d,a.e,a.f)},getTransform:function(){return this.getViewPortTransform().reverse()},addResource:function(a){return this.resources.appendItem(a),a.node&&this.resourceNode.appendChild(a.node),this},removeResource:function(a){return a.remove&&a.remove(),a.node&&this.resourceNode.removeChild(a.node),this},getPaper:function(){return this}}),k=_p.r(61);return a.extendClass(k,{getPaper:function(){for(var a=this.container;a&&a instanceof j==!1;)a=a.container;return a},isAttached:function(){return!!this.getPaper()},whenPaperReady:function(a){function b(){var b=c.getPaper();return b&&a&&a.call(c,b),b}var c=this;return b()||this.on("add treeadd",function d(){b()&&(c.off("add",d),c.off("treeadd",d))}),this}}),j}},_p[47]={value:function(){var a=_p.r(12),b=_p.r(11).createClass,c=_p.r(61),d=_p.r(68),e=_p.r(35),f=Array.prototype.slice,g=(a.flatten,b("PathDrawer",{constructor:function(a){this.segment=[],this.path=a,this.__clear=!1},getPath:function(){return this.path},redraw:function(){return this._transation=this._transation||[],this.clear()},done:function(){var a=this._transation;return this._transation=null,this.push(a),this},clear:function(){return this._transation?this._transation=[]:this.path.setPathData("M 0 0"),this._clear=!0,this},push:function(){var a,b=f.call(arguments);return this._transation?(this._transation.push(b),this):(this._clear?(a="",this._clear=!1):a=this.path.getPathData(),a=a||"",this.path.setPathData(a+e.pathToString(b)),this)},moveTo:function(){return this.push("M",f.call(arguments))},moveBy:function(){return this.push("m",f.call(arguments))},lineTo:function(){return this.push("L",f.call(arguments))},lineBy:function(){return this.push("l",f.call(arguments))},arcTo:function(){return this.push("A",f.call(arguments))},arcBy:function(){return this.push("a",arguments)},carcTo:function(a){return this.push("A",[a,a,0].concat(f.call(arguments,1)))},carcBy:function(a){return this.push("a",[a,a,0].concat(f.call(arguments,1)))},bezierTo:function(){return this.push("C",f.call(arguments))},bezierBy:function(){return this.push("c",f.call(arguments))},close:function(){return this.push("z")}}));return b("Path",{base:c,constructor:function(a){this.callBase("path"),a&&this.setPathData(a),this.node.setAttribute("fill",d.defaults.fill),this.node.setAttribute("stroke",d.defaults.stroke)},setPathData:function(a){return a=a||"M0,0",this.pathdata=e.pathToString(a),this.node.setAttribute("d",this.pathdata),this.trigger("shapeupdate",{type:"pathdata"}),this},getPathData:function(){return this.pathdata||""},getDrawer:function(){return new g(this)},isClosed:function(){var a=this.getPathData();return!!~a.indexOf("z")||!!~a.indexOf("Z")}})}},_p[48]={value:function(){{var a=_p.r(32),b=_p.r(62);_p.r(68)}return _p.r(11).createClass("PatternBrush",{base:a,mixins:[b],constructor:function(){this.callBase("pattern"),this.node.setAttribute("patternUnits","userSpaceOnUse")},setX:function(a){return this.x=a,this.node.setAttribute("x",a),this},setY:function(a){return this.y=a,this.node.setAttribute("y",a),this},setWidth:function(a){return this.width=a,this.node.setAttribute("width",a),this},setHeight:function(a){return this.height=a,this.node.setAttribute("height",a),this},getWidth:function(){return this.width},getHeight:function(){return this.height}})}},_p[49]={value:function(){var a=_p.r(28);return _p.r(11).createClass("Pen",{constructor:function(a,b){this.brush=a,this.width=b||1,this.linecap=null,this.linejoin=null,this.dashArray=null,this.opacity=1},getBrush:function(){return this.brush},setBrush:function(a){return this.brush=a,this},setColor:function(a){return this.setBrush(a)},getColor:function(){return this.brush instanceof a?this.brush:null},getWidth:function(){return this.width},setWidth:function(a){return this.width=a,this},getOpacity:function(){return this.opacity},setOpacity:function(a){this.opacity=a},getLineCap:function(){return this.linecap},setLineCap:function(a){return this.linecap=a,this},getLineJoin:function(){return this.linejoin},setLineJoin:function(a){return this.linejoin=a,this},getDashArray:function(){return this.dashArray},setDashArray:function(a){return this.dashArray=a,this},stroke:function(a){var b=a.node;b.setAttribute("stroke",this.brush.toString()),b.setAttribute("stroke-width",this.getWidth()),this.getOpacity()<1&&b.setAttribute("stroke-opacity",this.getOpacity()),this.getLineCap()&&b.setAttribute("stroke-linecap",this.getLineCap()),this.getLineJoin()&&b.setAttribute("stroke-linejoin",this.getLineJoin()),this.getDashArray()&&b.setAttribute("stroke-dasharray",this.getDashArray())}})}},_p[50]={value:function(){return _p.r(11).createClass({base:_p.r(69),constructor:function(a,b,c){this.callBase([0,a],b,c)},getRadius:function(){return this.getSectionArray()[1]},setRadius:function(a){this.setSectionArray([0,a])}})}},_p[51]={value:function(){var a=_p.r(11).createClass("Point",{constructor:function(a,b){this.x=a||0,this.y=b||0},offset:function(b,c){return 1==arguments.length&&(c=b.y,b=b.x),new a(this.x+b,this.y+c)},valueOf:function(){return[this.x,this.y]},toString:function(){return this.valueOf().join(" ")},spof:function(){return new a((0|this.x)+.5,(0|this.y)+.5)}});return a.fromPolar=function(b,c,d){return"rad"!=d&&(c=c/180*Math.PI),new a(b*Math.cos(c),b*Math.sin(c))},a.parse=function(b){return b instanceof a?b:"string"==typeof b?a.parse(b.split(/\s*[\s,]\s*/)):"0"in b&&"1"in b?new a(b[0],b[1]):void 0},a}},_p[52]={value:function(){return _p.r(11).createClass("PointContainer",{base:_p.r(29),constructor:function(){this.callBase()},addPoint:function(){return this.addItem.apply(this,arguments)},prependPoint:function(){return this.prependItem.apply(this,arguments)},appendPoint:function(){return this.appendItem.apply(this,arguments)},removePoint:function(){return this.removeItem.apply(this,arguments)},addPoints:function(){return this.addItems.apply(this,arguments)},setPoints:function(){return this.setItems.apply(this,arguments)},getPoint:function(){return this.getItem.apply(this,arguments)},getPoints:function(){return this.getItems.apply(this,arguments)},getFirstPoint:function(){return this.getFirstItem.apply(this,arguments)},getLastPoint:function(){return this.getLastItem.apply(this,arguments)}})}},_p[53]={value:function(){_p.r(12); +return _p.r(11).createClass("Poly",{base:_p.r(47),mixins:[_p.r(52)],constructor:function(a,b){this.callBase(),this.closeable=!!b,this.setPoints(a||[]),this.changeable=!0,this.update()},onContainerChanged:function(){this.changeable&&this.update()},update:function(){var a=this.getDrawer(),b=this.getPoints();if(a.clear(),!b.length)return this;a.moveTo(b[0]);for(var c,d=1,e=b.length;e>d;d++)c=b[d],a.lineTo(c);return this.closeable&&b.length>2&&a.close(),this}})}},_p[54]={value:function(){return _p.r(11).createClass("Polygon",{base:_p.r(53),constructor:function(a){this.callBase(a,!0)}})}},_p[55]={value:function(){return _p.r(11).createClass("Polyline",{base:_p.r(53),constructor:function(a){this.callBase(a)}})}},_p[56]={value:function(){var a=_p.r(36);return _p.r(11).createClass("RadialGradientBrush",{base:a,constructor:function(a){this.callBase("radialGradient"),this.setCenter(.5,.5),this.setFocal(.5,.5),this.setRadius(.5),"function"==typeof a&&a.call(this,this)},setCenter:function(a,b){return this.node.setAttribute("cx",a),this.node.setAttribute("cy",b),this},getCenter:function(){return{x:+this.node.getAttribute("cx"),y:+this.node.getAttribute("cy")}},setFocal:function(a,b){return this.node.setAttribute("fx",a),this.node.setAttribute("fy",b),this},getFocal:function(){return{x:+this.node.getAttribute("fx"),y:+this.node.getAttribute("fy")}},setRadius:function(a){return this.node.setAttribute("r",a),this},getRadius:function(){return+this.node.getAttribute("r")}})}},_p[57]={value:function(){var a={},b=_p.r(12),c=_p.r(51),d=_p.r(25);b.extend(a,{formatRadius:function(a,b,c){var d=Math.floor(Math.min(a/2,b/2));return Math.min(d,c)}});var e=_p.r(11).createClass("Rect",{base:_p.r(47),constructor:function(b,c,d,e,f){this.callBase(),this.x=d||0,this.y=e||0,this.width=b||0,this.height=c||0,this.radius=a.formatRadius(this.width,this.height,f||0),this.update()},update:function(){var a=this.x,b=this.y,c=this.width,d=this.height,e=this.radius,f=this.getDrawer().redraw();return e?(c-=2*e,d-=2*e,f.push("M",a+e,b),f.push("h",c),f.push("a",e,e,0,0,1,e,e),f.push("v",d),f.push("a",e,e,0,0,1,-e,e),f.push("h",-c),f.push("a",e,e,0,0,1,-e,-e),f.push("v",-d),f.push("a",e,e,0,0,1,e,-e),f.push("z")):(f.push("M",a,b),f.push("h",c),f.push("v",d),f.push("h",-c),f.push("z")),f.done(),this},setWidth:function(a){return this.width=a,this.update()},setHeight:function(a){return this.height=a,this.update()},setSize:function(a,b){return this.width=a,this.height=b,this.update()},setBox:function(a){return this.x=a.x,this.y=a.y,this.width=a.width,this.height=a.height,this.update()},getBox:function(){return new d(this.x,this.y,this.width,this.height)},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=a,this.update()},getPosition:function(){return new c(this.x,this.y)},setPosition:function(a,b){if(1==arguments.length){var d=c.parse(arguments[0]);b=d.y,a=d.x}return this.x=a,this.y=b,this.update()},getWidth:function(){return this.width},getHeight:function(){return this.height},getPositionX:function(){return this.x},getPositionY:function(){return this.y},setPositionX:function(a){return this.x=a,this.update()},setPositionY:function(a){return this.y=a,this.update()}});return e}},_p[58]={value:function(){var a=_p.r(51);return _p.r(11).createClass("RegularPolygon",{base:_p.r(47),constructor:function(b,c,d,e){this.callBase(),this.radius=c||0,this.side=Math.max(b||3,3),arguments.length>2&&3==arguments.length&&(e=d.y,d=d.x),this.center=new a(d,e),this.draw()},getSide:function(){return this.side},setSide:function(a){return this.side=a,this.draw()},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=a,this.draw()},draw:function(){var b,c=this.radius,d=this.side,e=2*Math.PI/d,f=this.getDrawer();for(f.clear(),f.moveTo(a.fromPolar(c,Math.PI/2,"rad").offset(this.center)),b=0;d>=b;b++)f.lineTo(a.fromPolar(c,e*b+Math.PI/2,"rad").offset(this.center));return f.close(),this}})}},_p[59]={value:function(){var a=_p.r(68);return _p.r(11).createClass("Resource",{constructor:function(b){this.callBase(),this.node=a.createNode(b)},toString:function(){return"url(#"+this.node.id+")"}})}},_p[60]={value:function(){return _p.r(11).createClass({base:_p.r(69),constructor:function(a,b){this.callBase([a,b],360,0)},getInnerRadius:function(){return this.getSectionArray()[0]},getOuterRadius:function(){return this.getSectionArray()[1]},setInnerRadius:function(a){this.setSectionArray([a,this.getOuterRadius()])},setOuterRadius:function(a){this.setSectionArray([this.getInnerRadius(),a])}})}},_p[61]={value:function(){var a=_p.r(68),b=_p.r(12),c=_p.r(34),d=_p.r(67),e=_p.r(31),f=_p.r(44),g=(_p.r(49),Array.prototype.slice),h=_p.r(25),i=_p.r(11).createClass("Shape",{mixins:[c,d,e],constructor:function(b){this.node=a.createNode(b),this.node.shape=this,this.transform={translate:null,rotate:null,scale:null,matrix:null},this.callMixin()},getId:function(){return this.node.id},setId:function(a){return this.node.id=a,this},getNode:function(){return this.node},getBoundaryBox:function(){var a;try{a=this.node.getBBox()}catch(b){a={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}return new h(a)},getRenderBox:function(a){var b=this.getBoundaryBox(),c=this.getTransform(a);return c.transformBox(b)},getWidth:function(){return this.getRenderBox().width},getHeight:function(){return this.getRenderBox().height},getSize:function(){var a=this.getRenderBox();return delete a.x,delete a.y,a},setOpacity:function(a){return this.node.setAttribute("opacity",a),this},getOpacity:function(){var a=this.node.getAttribute("opacity");return a?+a:1},setVisible:function(a){return a?this.node.removeAttribute("display"):this.node.setAttribute("display","none"),this},getVisible:function(){this.node.getAttribute("display")},hasAncestor:function(a){for(var b=this.container;b;){if(b===a)return!0;b=b.container}return!1},getTransform:function(a){return f.getCTM(this,a)},clearTransform:function(){return this.node.removeAttribute("transform"),this.transform={translate:null,rotate:null,scale:null,matrix:null},this.trigger("shapeupdate",{type:"transform"}),this},_applyTransform:function(){var a=this.transform,c=[];return a.translate&&c.push(["translate(",a.translate,")"]),a.rotate&&c.push(["rotate(",a.rotate,")"]),a.scale&&c.push(["scale(",a.scale,")"]),a.matrix&&c.push(["matrix(",a.matrix,")"]),this.node.setAttribute("transform",b.flatten(c).join(" ")),this},setMatrix:function(a){return this.transform.matrix=a,this._applyTransform()},setTranslate:function(a){return this.transform.translate=null!==a&&g.call(arguments)||null,this._applyTransform()},setRotate:function(a){return this.transform.rotate=null!==a&&g.call(arguments)||null,this._applyTransform()},setScale:function(a){return this.transform.scale=null!==a&&g.call(arguments)||null,this._applyTransform()},translate:function(a,b){var c=this.transform.matrix||new f;return void 0===b&&(b=0),this.transform.matrix=c.translate(a,b),this._applyTransform()},rotate:function(a){var b=this.transform.matrix||new f;return this.transform.matrix=b.rotate(a),this._applyTransform()},scale:function(a,b){var c=this.transform.matrix||new f;return void 0===b&&(b=a),this.transform.matrix=c.scale(a,b),this._applyTransform()},skew:function(a,b){var c=this.transform.matrix||new f;return void 0===b&&(b=a),this.transform.matrix=c.skew(a,b),this._applyTransform()},stroke:function(a,b){return a&&a.stroke?a.stroke(this):a?(this.node.setAttribute("stroke",a.toString()),b&&this.node.setAttribute("stroke-width",b)):null===a&&this.node.removeAttribute("stroe"),this},fill:function(a){return a&&this.node.setAttribute("fill",a.toString()),null===a&&this.node.removeAttribute("fill"),this},setAttr:function(a,c){var d=this;return b.isObject(a)&&b.each(a,function(a,b){d.setAttr(b,a)}),void 0===c||null===c||""===c?this.node.removeAttribute(a):this.node.setAttribute(a,c),this},getAttr:function(a){return this.node.getAttribute(a)}});return i}},_p[62]={value:function(){var a=_p.r(29),b=_p.r(12),c=_p.r(11).createClass("ShapeContainer",{base:a,isShapeContainer:!0,handleAdd:function(a,b){var c=this.getShapeNode();c.insertBefore(a.node,c.childNodes[b]||null),a.trigger("add",{container:this}),a.notifyTreeModification&&a.notifyTreeModification("treeadd",this)},handleRemove:function(a){var b=this.getShapeNode();b.removeChild(a.node),a.trigger("remove",{container:this}),a.notifyTreeModification&&a.notifyTreeModification("treeremove",this)},notifyTreeModification:function(a,b){this.eachItem(function(c,d){d.notifyTreeModification&&d.notifyTreeModification(a,b),d.trigger(a,{container:b})})},getShape:function(a){return this.getItem(a)},addShape:function(a,b){return this.addItem(a,b)},put:function(a){return this.addShape(a),a},appendShape:function(a){return this.addShape(a)},prependShape:function(a){return this.addShape(a,0)},replaceShape:function(a,b){var c=this.indexOf(b);if(-1!==c)return this.removeShape(c),this.addShape(a,c),this},addShapeBefore:function(a,b){var c=this.indexOf(b);return this.addShape(a,c)},addShapeAfter:function(a,b){var c=this.indexOf(b);return this.addShape(a,-1===c?void 0:c+1)},addShapes:function(a){return this.addItems(a)},removeShape:function(a){return this.removeItem(a)},getShapes:function(){return this.getItems()},getShapesByType:function(a){function c(e){a.toLowerCase()==e.getType().toLowerCase()&&d.push(e),e.isShapeContainer&&b.each(e.getShapes(),function(a){c(a)})}var d=[];return c(this),d},getShapeById:function(a){return this.getShapeNode().getElementById(a).shape},arrangeShape:function(a,b){return this.removeShape(a).addShape(a,b)},getShapeNode:function(){return this.shapeNode||this.node}}),d=_p.r(61);return _p.r(11).extendClass(d,{bringTo:function(a){return this.container.arrangeShape(this,a),this},bringFront:function(){return this.bringTo(this.container.indexOf(this)+1)},bringBack:function(){return this.bringTo(this.container.indexOf(this)-1)},bringTop:function(){return this.container.removeShape(this).addShape(this),this},bringRear:function(){return this.bringTo(0)},bringRefer:function(a,b){return a.container&&(this.remove&&this.remove(),a.container.addShape(this,a.container.indexOf(a)+(b||0))),this},bringAbove:function(a){return this.bringRefer(a)},bringBelow:function(a){return this.bringRefer(a,1)},replaceBy:function(a){return this.container&&(a.bringAbove(this),this.remove()),this}}),c}},_p[63]={value:function(){var a=_p.r(44),b=_p.r(12),c=_p.r(51);return _p.r(11).createClass("ShapeEvent",{constructor:function(a){var c=null;b.isObject(a.target)?b.extend(this,a):(this.type=a.type,c=a.target,c.correspondingUseElement&&(c=c.correspondingUseElement),this.originEvent=a,this.targetShape=c.shape||c.paper||a.currentTarget&&(a.currentTarget.shape||a.currentTarget.paper),a._kityParam&&b.extend(this,a._kityParam))},preventDefault:function(){var a=this.originEvent;return a?a.preventDefault?(a.preventDefault(),a.cancelable):(a.returnValue=!1,!0):!0},getPosition:function(b,d){if(!this.originEvent)return null;var e=this.originEvent.touches?this.originEvent.touches[d||0]:this.originEvent,f=this.targetShape,g=f.shapeNode||f.node,h=new c(e&&e.clientX||0,e&&e.clientY||0),i=a.transformPoint(h,g.getScreenCTM().inverse()),j=a.getCTM(f,b||"view").transformPoint(i);return j},stopPropagation:function(){var a=this.originEvent;return a?void(a.stopPropagation?a.stopPropagation():a.cancelBubble=!1):!0}})}},_p[64]={value:function(){return _p.r(11).createClass("ShapePoint",{base:_p.r(51),constructor:function(a,b){this.callBase(a,b)},setX:function(a){return this.setPoint(a,this.y)},setY:function(a){return this.setPoint(this.x,a)},setPoint:function(a,b){return this.x=a,this.y=b,this.update(),this},getPoint:function(){return this},update:function(){return this.container&&this.container.update&&this.container.update(),this}})}},_p[65]={value:{COLOR_STANDARD:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00"},EXTEND_STANDARD:{}}},_p[66]={value:function(){var a={3:.2,5:.38196601125,6:.57735026919,8:.541196100146,10:.726542528005,12:.707106781187},b=_p.r(51);return _p.r(11).createClass("Star",{base:_p.r(47),constructor:function(a,c,d,e,f){this.callBase(),this.vertex=a||3,this.radius=c||0,this.shrink=d,this.offset=e||new b(0,0),this.angleOffset=f||0,this.draw()},getVertex:function(){return this.vertex},setVertex:function(a){return this.vertex=a,this.draw()},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=a,this.draw()},getShrink:function(){return this.shrink},setShrink:function(a){return this.shrink=a,this.draw()},getOffset:function(){return this.offset},setOffset:function(a){return this.offset=a,this.draw()},getAngleOffset:function(){return this.angleOffset},setAngleOffset:function(a){return this.angleOffset=a,this.draw()},draw:function(){var c,d,e=this.radius,f=this.radius*(this.shrink||a[this.vertex]||.5),g=this.vertex,h=this.offset,i=90,j=180/g,k=this.angleOffset,l=this.getDrawer();for(l.clear(),l.moveTo(b.fromPolar(f,i)),c=1;2*g>=c;c++)d=i+j*c,l.lineTo(c%2?b.fromPolar(e,d+k).offset(h):b.fromPolar(f,d));l.close()}})}},_p[67]={value:function(){function a(a){return a.classList||(a.classList=new b(a)),a.classList}var b=_p.r(11).createClass("ClassList",{constructor:function(a){this._node=a,this._list=a.className.toString().split(" ")},_update:function(){this._node.className=this._list.join(" ")},add:function(a){this._list.push(a),this._update()},remove:function(a){var b=this._list.indexOf(a);~b&&this._list.splice(b,1),this._update()},contains:function(a){return!!~this._list.indexOf(a)}});return _p.r(11).createClass("Styled",{addClass:function(b){return a(this.node).add(b),this},removeClass:function(b){return a(this.node).remove(b),this},hasClass:function(b){return a(this.node).contains(b)},setStyle:function(a){if(2==arguments.length)return this.node.style[arguments[0]]=arguments[1],this;for(var b in a)a.hasOwnProperty(b)&&(this.node.style[b]=a[b]);return this}})}},_p[68]={value:function(){var a=document,b=0,c={createNode:function(d){var e=a.createElementNS(c.ns,d);return e.id="kity_"+d+"_"+b++,e},defaults:{stroke:"none",fill:"none"},xlink:"http://www.w3.org/1999/xlink",ns:"http://www.w3.org/2000/svg"};return c}},_p[69]={value:function(){var a=_p.r(51);return _p.r(11).createClass("Sweep",{base:_p.r(47),constructor:function(a,b,c){this.callBase(),this.sectionArray=a||[],this.angle=b||0,this.angleOffset=c||0,this.draw()},getSectionArray:function(){return this.sectionArray},setSectionArray:function(a){return this.sectionArray=a,this.draw()},getAngle:function(){return this.angle},setAngle:function(a){return this.angle=a,this.draw()},getAngleOffset:function(){return this.angleOffset},setAngleOffset:function(a){return this.angleOffset=a,this.draw()},draw:function(){var a,b=this.sectionArray;for(a=0;a0?1:-1;return 180*c*b/Math.PI}});return c.fromPoints=function(a,b){return new c(b.x-a.x,b.y-a.y)},_p.r(11).extendClass(a,{asVector:function(){return new c(this.x,this.y)}}),c}},_p[75]={value:function(){var a=_p.r(62),b=_p.r(76);return _p.r(11).createClass("View",{mixins:[a,b],base:_p.r(75),constructor:function(){this.callBase("view")}})}},_p[76]={value:function(){return _p.r(11).createClass("ViewBox",{getViewBox:function(){var a=this.node.getAttribute("viewBox");return null===a?{x:0,y:0,width:this.node.clientWidth||this.node.parentNode.clientWidth,height:this.node.clientHeight||this.node.parentNode.clientHeight}:(a=a.split(" "),{x:+a[0],y:+a[1],width:+a[2],height:+a[3]})},setViewBox:function(a,b,c,d){return this.node.setAttribute("viewBox",[a,b,c,d].join(" ")),this}})}},_p[77]={value:function(){var a={},b=_p.r(12);return a.version="2.0.0",b.extend(a,{createClass:_p.r(11).createClass,extendClass:_p.r(11).extendClass,Utils:b,Browser:_p.r(10),Box:_p.r(25),Bezier:_p.r(23),BezierPoint:_p.r(24),Circle:_p.r(26),Clip:_p.r(27),Color:_p.r(28),Container:_p.r(29),Curve:_p.r(30),Ellipse:_p.r(33),GradientBrush:_p.r(36),Group:_p.r(37),HyperLink:_p.r(38),Image:_p.r(39),Line:_p.r(40),LinearGradientBrush:_p.r(41),Mask:_p.r(43),Matrix:_p.r(44),Marker:_p.r(42),Palette:_p.r(45),Paper:_p.r(46),Path:_p.r(47),PatternBrush:_p.r(48),Pen:_p.r(49),Point:_p.r(51),PointContainer:_p.r(52),Polygon:_p.r(54),Polyline:_p.r(55),Pie:_p.r(50),RadialGradientBrush:_p.r(56),Rect:_p.r(57),RegularPolygon:_p.r(58),Ring:_p.r(60),Shape:_p.r(61),ShapePoint:_p.r(64),ShapeContainer:_p.r(62),Sweep:_p.r(69),Star:_p.r(66),Text:_p.r(70),TextSpan:_p.r(72),Use:_p.r(73),Vector:_p.r(74),g:_p.r(35),Animator:_p.r(0),Easing:_p.r(1),OpacityAnimator:_p.r(4),RotateAnimator:_p.r(6),ScaleAnimator:_p.r(7),Timeline:_p.r(8),TranslateAnimator:_p.r(9),PathAnimator:_p.r(5),MotionAnimator:_p.r(3),requestFrame:_p.r(2).requestFrame,releaseFrame:_p.r(2).releaseFrame,Filter:_p.r(20),GaussianblurFilter:_p.r(21),ProjectionFilter:_p.r(22),ColorMatrixEffect:_p.r(13),CompositeEffect:_p.r(14),ConvolveMatrixEffect:_p.r(15),Effect:_p.r(16),GaussianblurEffect:_p.r(17),OffsetEffect:_p.r(18)}),window.kity=a}};var moduleMapping={kity:77};use("kity")}(); \ No newline at end of file diff --git a/demo/coordinate/coordinate.js b/example/coordinate/coordinate.js similarity index 100% rename from demo/coordinate/coordinate.js rename to example/coordinate/coordinate.js diff --git a/demo/coordinate/ex1.html b/example/coordinate/ex1.html similarity index 100% rename from demo/coordinate/ex1.html rename to example/coordinate/ex1.html diff --git a/demo/coordinate/ex2.html b/example/coordinate/ex2.html similarity index 100% rename from demo/coordinate/ex2.html rename to example/coordinate/ex2.html diff --git a/demo/coordinate/ex3.html b/example/coordinate/ex3.html similarity index 100% rename from demo/coordinate/ex3.html rename to example/coordinate/ex3.html diff --git a/demo/coordinate/ex4.html b/example/coordinate/ex4.html similarity index 100% rename from demo/coordinate/ex4.html rename to example/coordinate/ex4.html diff --git a/demo/coordinate/ex5.html b/example/coordinate/ex5.html similarity index 100% rename from demo/coordinate/ex5.html rename to example/coordinate/ex5.html diff --git a/demo/coordinate/ex6.html b/example/coordinate/ex6.html similarity index 100% rename from demo/coordinate/ex6.html rename to example/coordinate/ex6.html diff --git a/package.json b/package.json index eae4908..6f74885 100644 --- a/package.json +++ b/package.json @@ -28,13 +28,12 @@ }], "dependencies": {}, "devDependencies": { - "grunt": "~0.4.1", - "grunt-cmd-transport": "~0.3.0", - "grunt-cmd-concat": "~0.2.5", + "grunt": "~0.4.2", + "grunt-module-dependence": "~0.1.4", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-uglify": "~0.2.6", "grunt-contrib-clean": "~0.5.0", - "grunt-contrib-jasmine": "~0.4.0", + "grunt-contrib-jasmine": "~0.5.3", "grunt-contrib-connect": "~0.4.0" } diff --git a/src/graphic/shapeevent.js b/src/graphic/shapeevent.js index 4b31a1d..be65536 100644 --- a/src/graphic/shapeevent.js +++ b/src/graphic/shapeevent.js @@ -89,7 +89,7 @@ define(function(require, exprots, module) { var target = this.targetShape; var targetNode = target.shapeNode || target.node; - var pScreen = new kity.Point( + var pScreen = new Point( eventClient && eventClient.clientX || 0, eventClient && eventClient.clientY || 0 );