Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonsanjose committed Apr 5, 2012
1 parent e24f32d commit f5eb2ac
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/editor/CSSInlineEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,10 @@ define(function (require, exports, module) {
rcTop = this.$relatedContainer.offset().top,
rcHeight = this.$relatedContainer.outerHeight(),
rcBottom = rcTop + rcHeight,
scrollerTop = $(hostScroller).offset().top,
scrollerOffset = $(hostScroller).offset(),
scrollerTop = scrollerOffset.top,
scrollerBottom = scrollerTop + hostScroller.clientHeight,
scrollerLeft = $(hostScroller).offset().left,
scrollerLeft = scrollerOffset.left,
rightOffset = $(document.body).outerWidth() - (scrollerLeft + hostScroller.clientWidth);
if (rcTop < scrollerTop || rcBottom > scrollerBottom) {
this.$relatedContainer.css("clip", "rect(" + Math.max(scrollerTop - rcTop, 0) + "px, auto, " +
Expand All @@ -261,15 +262,9 @@ define(function (require, exports, module) {
this._relatedContainerDefaultWidth = relatedContainerWidth;
}

var halfWidth = hostScroller.clientWidth / 2;

if (this._relatedContainerDefaultWidth >= halfWidth) {
relatedContainerWidth = halfWidth;
} else {
relatedContainerWidth = this._relatedContainerDefaultWidth;
}

this.$relatedContainer.width(Math.floor(relatedContainerWidth));
var halfWidth = Math.floor(hostScroller.clientWidth / 2);
relatedContainerWidth = Math.min(this._relatedContainerDefaultWidth, halfWidth);
this.$relatedContainer.width(relatedContainerWidth);
}

// Position immediately to the left of the main editor's scrollbar.
Expand Down

0 comments on commit f5eb2ac

Please sign in to comment.