12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>Boundary Box Example</title>
- <!-- 正式发布的时候, 只需替换掉相应的脚本文件即可 -->
- <!-- dev 版本 示例所需脚本文件 start -->
- <script src="../dev-lib/sea.js"></script>
- <script>
- seajs.config({
- base: '../src'
- });
- </script>
- <script src="../dev-lib/exports.js"></script>
- <script src="../dev-lib/dev-start.js"></script>
- <!-- dev 版本 示例所需脚本文件 end -->
- <!-- 正式版本 示例所需脚本文件 start -->
- <!--<script src="../dist/kitygraph.all.min.js"></script>-->
- <!-- 正式版本 示例所需脚本文件 end -->
- <script>
- window.onload = function () {
- var paper = new kity.Paper(document.body);
- function rbox(shape) {
- var box = shape.getRenderBox();
- return new kity.Rect(box.width | 0, box.height | 0, (box.x | 0) + .5, (box.y | 0) + .5).stroke('green');
- }
- paper.setWidth(600).setHeight(400);
- var rect = new kity.Rect(100, 50)
- .setTranslate(20, 20)
- .fill('blue').setOpacity(0.3);
- var triangle = new kity.RegularPolygon(3, 50)
- .setTranslate(200, 50).setRotate(90)
- .fill('blue').setOpacity(0.3);
- var circle = new kity.Circle(30, 205, 35)
- .setScale(1.5)
- .fill('blue').setOpacity(0.3);
- paper.addShapes([rect, triangle, circle]);
- paper.addShapes([rect, triangle, circle].map(rbox));
- };
- </script>
- </head>
- <body>
-
- </body>
- </html>
|