| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
ve.dm.ResizableNode = function VeDmResizableNode() { |
| 17 |
this.scalable = null; |
| 18 |
|
| 19 |
this.connect( this, { attributeChange: 'onResizableAttributeChange' } ); |
| 20 |
}; |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
OO.initClass( ve.dm.ResizableNode ); |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
ve.dm.ResizableNode.prototype.getScalable = function () { |
| 34 |
if ( !this.scalable ) { |
| 35 |
this.scalable = this.createScalable(); |
| 36 |
} |
| 37 |
return this.scalable; |
| 38 |
}; |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
ve.dm.ResizableNode.prototype.createScalable = null; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
ve.dm.ResizableNode.prototype.onResizableAttributeChange = function ( key ) { |
| 56 |
if ( key === 'width' || key === 'height' ) { |
| 57 |
this.getScalable().setCurrentDimensions( this.getCurrentDimensions() ); |
| 58 |
} |
| 59 |
}; |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
ve.dm.ResizableNode.prototype.getCurrentDimensions = function () { |
| 67 |
return { |
| 68 |
width: this.getAttribute( 'width' ), |
| 69 |
height: this.getAttribute( 'height' ) |
| 70 |
}; |
| 71 |
}; |