http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97956
Revision: 97956
Author: tparscal
Date: 2011-09-23 21:01:37 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
Added newFromElementOffset and newFromElementPosition to es.Position
Modified Paths:
--------------
trunk/parsers/wikidom/lib/synth/es.Position.js
Modified: trunk/parsers/wikidom/lib/synth/es.Position.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/es.Position.js 2011-09-23 20:59:06 UTC
(rev 97955)
+++ trunk/parsers/wikidom/lib/synth/es.Position.js 2011-09-23 21:01:37 UTC
(rev 97956)
@@ -21,6 +21,32 @@
/* Static Methods */
/**
+ * Creates position object from the offset of an element.
+ *
+ * @static
+ * @method
+ * @param $element {jQuery} Element to get offset from
+ * @returns {es.Position} Position with element data applied
+ */
+es.Position.newFromElementOffset = function( $element ) {
+ var offset = $element.offset();
+ return new es.Position( offset.left, offset.top );
+};
+
+/**
+ * Creates position object from the position of an element.
+ *
+ * @static
+ * @method
+ * @param $element {jQuery} Element to get position from
+ * @returns {es.Position} Position with element data applied
+ */
+es.Position.newFromElementPosition = function( $element ) {
+ var position = $element.position();
+ return new es.Position( position.left, position.top );
+};
+
+/**
* Creates position object from the screen position data in an Event object.
*
* @static
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs