_boxv.js 865 B

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * @fileOverview
  3. *
  4. * 调试工具:为 kity.Box 提供一个可视化的渲染
  5. *
  6. * @author: techird
  7. * @copyright: Baidu FEX, 2014
  8. */
  9. define(function(require, exports, module) {
  10. var kity = require('./kity');
  11. var Minder = require('./minder');
  12. if (location.href.indexOf('boxv') != -1) {
  13. var vrect;
  14. Object.defineProperty(kity.Box.prototype, 'visualization', {
  15. get: function() {
  16. if (!vrect) return null;
  17. return vrect.setBox(this);
  18. }
  19. });
  20. Minder.registerInitHook(function() {
  21. this.on('paperrender', function() {
  22. vrect = new kity.Rect();
  23. vrect.fill('rgba(200, 200, 200, .5)');
  24. vrect.stroke('orange');
  25. this.getRenderContainer().addShape(vrect);
  26. });
  27. });
  28. }
  29. });