Skip to content

Instantly share code, notes, and snippets.

@jviereck
Created January 6, 2010 00:10
Show Gist options
  • Save jviereck/269882 to your computer and use it in GitHub Desktop.
Save jviereck/269882 to your computer and use it in GitHub Desktop.
_clippingFrameChanged: function() {
// False positives here are very common, so check to make sure before
// we take the slow path.
var previousClippingFrame = this._previousClippingFrame;
var clippingFrame = this.get('clippingFrame');
if (previousClippingFrame === null ||
!SC.rectsEqual(clippingFrame, previousClippingFrame)) {
// Move the content of the editor around.
if (previousClippingFrame !== null && this._bespin_canvas_canvasDom !== null) {
var shiftY = previousClippingFrame.y - clippingFrame.y;
this.moveRegion(0, 0,
previousClippingFrame.width, previousClippingFrame.height,
0, shiftY);
var repaintRect = {};
if (shiftY < 0) {
repaintRect = {
x: 0,
y: clippingFrame.y + clippingFrame.height + shiftY,
width: clippingFrame.width,
height: -shiftY + 10
};
} else {
repaintRect = {
x: 0,
y: clippingFrame.y,
width: clippingFrame.width,
height: shiftY + 10
};
}
// console.log(clippingFrame, this.get('layerFrame'));
//this._backgroundInvalid = true;
this._invalidRange = this.get('layoutManager').
characterRangeForBoundingRect(repaintRect);
} else {
this._invalidate();
}
this._previousClippingFrame = clippingFrame;
}
}.observes('clippingFrame'),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment