Index: trunk/parsers/wikidom/lib/synth/es.Position.js |
— | — | @@ -21,6 +21,32 @@ |
22 | 22 | /* Static Methods */ |
23 | 23 | |
24 | 24 | /** |
| 25 | + * Creates position object from the offset of an element. |
| 26 | + * |
| 27 | + * @static |
| 28 | + * @method |
| 29 | + * @param $element {jQuery} Element to get offset from |
| 30 | + * @returns {es.Position} Position with element data applied |
| 31 | + */ |
| 32 | +es.Position.newFromElementOffset = function( $element ) { |
| 33 | + var offset = $element.offset(); |
| 34 | + return new es.Position( offset.left, offset.top ); |
| 35 | +}; |
| 36 | + |
| 37 | +/** |
| 38 | + * Creates position object from the position of an element. |
| 39 | + * |
| 40 | + * @static |
| 41 | + * @method |
| 42 | + * @param $element {jQuery} Element to get position from |
| 43 | + * @returns {es.Position} Position with element data applied |
| 44 | + */ |
| 45 | +es.Position.newFromElementPosition = function( $element ) { |
| 46 | + var position = $element.position(); |
| 47 | + return new es.Position( position.left, position.top ); |
| 48 | +}; |
| 49 | + |
| 50 | +/** |
25 | 51 | * Creates position object from the screen position data in an Event object. |
26 | 52 | * |
27 | 53 | * @static |