Permalink
Browse files

added support for cursor styles depending on its relative position

  • Loading branch information...
mthiede committed Oct 23, 2010
1 parent 8ca1ea9 commit ff8d588825aa825fd7d524f0c45b99d402f0643e
Showing with 30 additions and 3 deletions.
  1. +4 −0 CHANGELOG
  2. +16 −0 concrete/editor.js
  3. +4 −2 concrete/selector.js
  4. +5 −1 doc/concrete_developers_guide.html
  5. +1 −0 doc/concrete_developers_guide.txt
View
@@ -37,3 +37,7 @@
* Fixed bug not allowing to finish editing of a text attribute if an integer attribute has been edited before
* Fixed bug not allowing to position the cursor with the mouse in a text field in edit mode
+=0.2.2
+
+* Added support for cursor styles depeding its relative position (left/right/top/bottom)
+
View
@@ -515,6 +515,22 @@ Concrete.Editor = Class.create({
var cur = this.selector.getCursorPosition();
var poff = this.marker.getOffsetParent().cumulativeOffset();
this.marker.setStyle({left: cur.x-poff.left+'px', top: cur.y-poff.top+'px'});
+ if (cur.yratio < 0.5) {
+ this.marker.addClassName("ct_cursor_top");
+ this.marker.removeClassName("ct_cursor_bottom");
+ }
+ else {
+ this.marker.addClassName("ct_cursor_bottom");
+ this.marker.removeClassName("ct_cursor_top");
+ }
+ if (cur.xratio < 0.5) {
+ this.marker.addClassName("ct_cursor_left");
+ this.marker.removeClassName("ct_cursor_right");
+ }
+ else {
+ this.marker.addClassName("ct_cursor_right");
+ this.marker.removeClassName("ct_cursor_left");
+ }
},
getModel: function() {
View
@@ -118,10 +118,12 @@ Concrete.Selector = Class.create({
if (this.cursor.element) {
return {
x: this.cursor.element.left()+this.cursor.x*Element.getWidth(this.cursor.element),
- y: this.cursor.element.top()+this.cursor.y*Element.getHeight(this.cursor.element) };
+ y: this.cursor.element.top()+this.cursor.y*Element.getHeight(this.cursor.element),
+ xratio: this.cursor.x,
+ yratio: this.cursor.y };
}
else {
- return {x: 0, y: 0};
+ return {x: 0, y: 0, xratio: 0, yratio: 0};
}
},
@@ -913,6 +913,10 @@ <h2 id="_css_class_reference">CSS Class Reference</h2>
<td align="left" valign="top"><p class="table">cursor on the border of the currently selected element</p></td>
</tr>
<tr>
+<td align="left" valign="top"><p class="table">ct_cursor_(left|top|right|bottom)</p></td>
+<td align="left" valign="top"><p class="table">additional classes set on the cursor to indicate its relative position</p></td>
+</tr>
+<tr>
<td align="left" valign="top"><p class="table">ct_empty</p></td>
<td align="left" valign="top"><p class="table">empty value or element placeholder</p></td>
</tr>
@@ -1050,7 +1054,7 @@ <h2 id="_css_class_reference">CSS Class Reference</h2>
</div>
<div id="footer">
<div id="footer-text">
-Last updated 2010-06-30 08:10:12 WEDT
+Last updated 2010-10-23 16:02:59 WEDT
</div>
</div>
</body>
@@ -466,6 +466,7 @@ The "workbench" should cover a number of editing usecases without change. In cas
| ct_focus | this class is present at the editor node if it is focused
| ct_selected | this class is present at an element or value if it is selected
| ct_cursor | cursor on the border of the currently selected element
+| ct_cursor_(left\|top\|right\|bottom) | additional classes set on the cursor to indicate its relative position
| ct_empty | empty value or element placeholder
| ct_fold_button | marks the fold button
| ct_fold_open | present at the fold button when the fold is open

0 comments on commit ff8d588

Please sign in to comment.