What I have now is...
The cursor drawing function...
_drawInsertionPoint: function(rect, context) {
var range = this._selectedRange;
var characterRect = this.get('layoutManager').
characterRectForPosition(range.start);
context.save();
context.strokeStyle = this.get('theme').cursorStyle;
context.beginPath();
context.moveTo(characterRect.x + 0.5, characterRect.y);
context.lineTo(characterRect.x + 0.5,
characterRect.y + characterRect.height);
context.closePath();
context.stroke();
context.restore();
},
The timer function...
_cursorBlinkTimer: function() {
this._cursorBlinkTimer = SC.Timer.schedule({
target: this,
action: '_fireDrawInsertionPoint', /*Had _drawInsertionPoint but can't pass in parameters with this */
interval: 250,
repeats: true
});
},
I thought it needed some sort of other method to send in the parameters but that would need to be called using parameters in the action: property above so that couldn't work...
_fireDrawInsertionPoint: function(rect, context) {
if(this.get('isFirstResponder')) {
drawInsertionPoint(rect, context);
}
},
The place that calls the cursor drawing function...
_drawSelection: function(rect, context) {
if (this._rangeIsInsertionPoint(this._selectedRange)) {
this._drawInsertionPoint(rect, context); //Thought this had to be this._cursorBlinkTimer()
} else {
this._drawSelectionHighlight(rect, context);
}
},
So I'm in a bit of a bind and have been looking around for quite some time but am not coming up with much to go on. I even asked Yahoo Answers lol and they said the way it was coded would be tricky. A fellow on irc told me that I should look into property-observing functions of SC...for something like an isCursorVisible property...I've been looking but haven't been coming up with much and that is much different than what I have done so far but anything is acceptable as long as it works and is it good taste. Hmm. Tricky.
No comments:
Post a Comment