123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- define(function(require, exports, module) {
- return require('../core/class').createClass('Image', {
- base: require('./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;
- }
- });
- });
|