Index: trunk/parsers/wikidom/lib/synth/controllers/es.SurfaceController.js |
— | — | @@ -169,32 +169,3 @@ |
170 | 170 | es.SurfaceController.prototype.setInputContent = function( content ) { |
171 | 171 | // TODO: Set the value of this.$input |
172 | 172 | }; |
173 | | - |
174 | | -es.SurfaceController.prototype.getLocationFromEvent = function( e ) { |
175 | | - var $target = $( e.target ), |
176 | | - $block = $target.is( '.editSurface-block' ) |
177 | | - ? $target : $target.closest( '.editSurface-block' ); |
178 | | - // Not a block or child of a block? Find the nearest block... |
179 | | - if( !$block.length ) { |
180 | | - var $blocks = this.$.find( '> .editSurface-document .editSurface-block' ); |
181 | | - $block = $blocks.first(); |
182 | | - $blocks.each( function() { |
183 | | - // Stop looking when mouse is above top |
184 | | - if ( e.pageY <= $(this).offset().top ) { |
185 | | - return false; |
186 | | - } |
187 | | - $block = $(this); |
188 | | - } ); |
189 | | - } |
190 | | - var block = $block.data( 'block' ), |
191 | | - blockPosition = $block.offset(); |
192 | | - return new es.Location( |
193 | | - block, |
194 | | - block.getOffset( |
195 | | - new es.Position( |
196 | | - e.pageX - blockPosition.left, |
197 | | - e.pageY - blockPosition.top |
198 | | - ) |
199 | | - ) |
200 | | - ); |
201 | | -}; |
Index: trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js |
— | — | @@ -74,3 +74,40 @@ |
75 | 75 | } |
76 | 76 | this.$cursor.hide(); |
77 | 77 | }; |
| 78 | + |
| 79 | +es.SurfaceView.prototype.getLocationFromEvent = function( e ) { |
| 80 | + var $target = $( e.target ), |
| 81 | + $block = $target.is( '.editSurface-block' ) |
| 82 | + ? $target : $target.closest( '.editSurface-block' ); |
| 83 | + // Not a block or child of a block? Find the nearest block... |
| 84 | + if ( !$block.length ) { |
| 85 | + var $blocks = this.$.find( '> .editSurface-document .editSurface-block' ); |
| 86 | + $block = $blocks.first(); |
| 87 | + $blocks.each( function() { |
| 88 | + // Stop looking when mouse is above top |
| 89 | + if ( e.pageY <= $(this).offset().top ) { |
| 90 | + return false; |
| 91 | + } |
| 92 | + $block = $(this); |
| 93 | + } ); |
| 94 | + } |
| 95 | + var block = $block.data( 'block' ), |
| 96 | + blockPosition = $block.offset(); |
| 97 | + return new es.Location( |
| 98 | + block, |
| 99 | + block.getOffset( |
| 100 | + new es.Position( |
| 101 | + e.pageX - blockPosition.left, |
| 102 | + e.pageY - blockPosition.top |
| 103 | + ) |
| 104 | + ) |
| 105 | + ); |
| 106 | +}; |
| 107 | + |
| 108 | +es.SurfaceView.prototype.getLocationFromOffset = function( offset ) { |
| 109 | + |
| 110 | +}; |
| 111 | + |
| 112 | +es.SurfaceView.prototype.getLocationFromPosition = function( position ) { |
| 113 | + |
| 114 | +}; |