r97957 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97956‎ | r97957 | r97958 >
Date:21:05, 23 September 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Renamed things to not reduce confusion of the word "offset"
Modified paths:
  • /trunk/parsers/wikidom/lib/synth/es.Position.js (modified) (history)
  • /trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/synth/es.Position.js
@@ -21,27 +21,27 @@
2222 /* Static Methods */
2323
2424 /**
25 - * Creates position object from the offset of an element.
 25+ * Creates position object from the page position of an element.
2626 *
2727 * @static
2828 * @method
2929 * @param $element {jQuery} Element to get offset from
3030 * @returns {es.Position} Position with element data applied
3131 */
32 -es.Position.newFromElementOffset = function( $element ) {
 32+es.Position.newFromElementPagePosition = function( $element ) {
3333 var offset = $element.offset();
3434 return new es.Position( offset.left, offset.top );
3535 };
3636
3737 /**
38 - * Creates position object from the position of an element.
 38+ * Creates position object from the layer position of an element.
3939 *
4040 * @static
4141 * @method
4242 * @param $element {jQuery} Element to get position from
4343 * @returns {es.Position} Position with element data applied
4444 */
45 -es.Position.newFromElementPosition = function( $element ) {
 45+es.Position.newFromElementLayerPosition = function( $element ) {
4646 var position = $element.position();
4747 return new es.Position( position.left, position.top );
4848 };
Index: trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js
@@ -255,6 +255,7 @@
256256 es.SurfaceView.prototype.onMouseMove = function( e ) {
257257 if (this.selecting ) {
258258 var position = es.Position.newFromEventPagePosition( e );
 259+ position.subtract( es.Position.newFromElementPagePosition( this.documentView.$ ) );
259260 var offset = this.documentView.getOffsetFromPosition( position );
260261 this.to = offset;
261262 this.documentView.drawSelection( new es.Range( this.from, this.to ) );

Status & tagging log