12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- jvm.AbstractCanvasElement = function(container, width, height){
- this.container = container;
- this.setSize(width, height);
- this.rootElement = new jvm[this.classPrefix+'GroupElement']();
- this.node.appendChild( this.rootElement.node );
- this.container.appendChild(this.node);
- }
- jvm.AbstractCanvasElement.prototype.add = function(element, group){
- group = group || this.rootElement;
- group.add(element);
- element.canvas = this;
- }
- jvm.AbstractCanvasElement.prototype.addPath = function(config, style, group){
- var el = new jvm[this.classPrefix+'PathElement'](config, style);
- this.add(el, group);
- return el;
- };
- jvm.AbstractCanvasElement.prototype.addCircle = function(config, style, group){
- var el = new jvm[this.classPrefix+'CircleElement'](config, style);
- this.add(el, group);
- return el;
- };
- jvm.AbstractCanvasElement.prototype.addGroup = function(parentGroup){
- var el = new jvm[this.classPrefix+'GroupElement']();
- if (parentGroup) {
- parentGroup.node.appendChild(el.node);
- } else {
- this.node.appendChild(el.node);
- }
- el.canvas = this;
- return el;
- };
|