[DE] Fix review balloon position
This commit is contained in:
parent
6c5f96b75b
commit
cfd5638646
|
@ -1185,7 +1185,8 @@ define([
|
||||||
renderTo : this.sdkViewName,
|
renderTo : this.sdkViewName,
|
||||||
canRequestUsers: (this.mode) ? this.mode.canRequestUsers : undefined,
|
canRequestUsers: (this.mode) ? this.mode.canRequestUsers : undefined,
|
||||||
canRequestSendNotify: (this.mode) ? this.mode.canRequestSendNotify : undefined,
|
canRequestSendNotify: (this.mode) ? this.mode.canRequestSendNotify : undefined,
|
||||||
mentionShare: (this.mode) ? this.mode.mentionShare : true
|
mentionShare: (this.mode) ? this.mode.mentionShare : true,
|
||||||
|
api: this.api
|
||||||
});
|
});
|
||||||
this.popover.setCommentsStore(this.popoverComments);
|
this.popover.setCommentsStore(this.popoverComments);
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,7 +255,8 @@ define([
|
||||||
if ((this.appConfig.canReview || this.appConfig.canViewReview) && _.isUndefined(this.popover)) {
|
if ((this.appConfig.canReview || this.appConfig.canViewReview) && _.isUndefined(this.popover)) {
|
||||||
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
|
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
|
||||||
reviewStore : this.popoverChanges,
|
reviewStore : this.popoverChanges,
|
||||||
renderTo : this.sdkViewName
|
renderTo : this.sdkViewName,
|
||||||
|
api: this.api
|
||||||
});
|
});
|
||||||
this.popover.setReviewStore(this.popoverChanges);
|
this.popover.setReviewStore(this.popoverChanges);
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,7 @@ define([
|
||||||
this.canRequestUsers = options.canRequestUsers;
|
this.canRequestUsers = options.canRequestUsers;
|
||||||
this.canRequestSendNotify = options.canRequestSendNotify;
|
this.canRequestSendNotify = options.canRequestSendNotify;
|
||||||
this.mentionShare = options.mentionShare;
|
this.mentionShare = options.mentionShare;
|
||||||
|
this.api = options.api;
|
||||||
this.externalUsers = [];
|
this.externalUsers = [];
|
||||||
this._state = {commentsVisible: false, reviewVisible: false};
|
this._state = {commentsVisible: false, reviewVisible: false};
|
||||||
|
|
||||||
|
@ -784,7 +785,7 @@ define([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!retainContent)
|
if (!retainContent || this.isOverCursor())
|
||||||
this.calculateSizeOfContent();
|
this.calculateSizeOfContent();
|
||||||
},
|
},
|
||||||
calculateSizeOfContent: function (testVisible) {
|
calculateSizeOfContent: function (testVisible) {
|
||||||
|
@ -839,7 +840,34 @@ define([
|
||||||
|
|
||||||
outerHeight = Math.max(commentsView.outerHeight(), this.$window.outerHeight());
|
outerHeight = Math.max(commentsView.outerHeight(), this.$window.outerHeight());
|
||||||
|
|
||||||
if (sdkBoundsHeight <= outerHeight) {
|
var movePos = this.isOverCursor();
|
||||||
|
if (movePos) {
|
||||||
|
var newTopDown = movePos[1] + sdkPanelHeight,// try move down
|
||||||
|
newTopUp = movePos[0] + sdkPanelHeight; // try move up
|
||||||
|
if (newTopDown + outerHeight>sdkBoundsTop + sdkBoundsHeight) {
|
||||||
|
var diffDown = sdkBoundsTop + sdkBoundsHeight - newTopDown;
|
||||||
|
if (newTopUp - outerHeight<sdkBoundsTop) {
|
||||||
|
var diffUp = newTopUp - sdkBoundsTop;
|
||||||
|
if (diffDown < diffUp * 0.9) {// magic)
|
||||||
|
this.$window.css({
|
||||||
|
maxHeight: diffUp + 'px',
|
||||||
|
top: sdkBoundsTop + 'px'
|
||||||
|
});
|
||||||
|
commentsView.css({height: diffUp - 3 + 'px'});
|
||||||
|
} else {
|
||||||
|
this.$window.css({
|
||||||
|
maxHeight: diffDown + 'px',
|
||||||
|
top: newTopDown + 'px'
|
||||||
|
});
|
||||||
|
commentsView.css({height: diffDown - 3 + 'px'});
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
this.$window.css('top', newTopUp - outerHeight + 'px'); // move up
|
||||||
|
} else
|
||||||
|
this.$window.css('top', newTopDown + 'px'); // move down
|
||||||
|
arrowView.addClass('hidden');
|
||||||
|
|
||||||
|
} else if (sdkBoundsHeight <= outerHeight) {
|
||||||
this.$window.css({
|
this.$window.css({
|
||||||
maxHeight: sdkBoundsHeight - sdkPanelHeight + 'px',
|
maxHeight: sdkBoundsHeight - sdkPanelHeight + 'px',
|
||||||
top: sdkBoundsTop + sdkPanelHeight + 'px'
|
top: sdkBoundsTop + sdkPanelHeight + 'px'
|
||||||
|
@ -851,6 +879,7 @@ define([
|
||||||
arrowPosY = Math.min(arrowPosY, sdkBoundsHeight - (sdkPanelHeight + this.arrow.margin + this.arrow.height));
|
arrowPosY = Math.min(arrowPosY, sdkBoundsHeight - (sdkPanelHeight + this.arrow.margin + this.arrow.height));
|
||||||
|
|
||||||
arrowView.css({top: arrowPosY + 'px'});
|
arrowView.css({top: arrowPosY + 'px'});
|
||||||
|
arrowView.removeClass('hidden');
|
||||||
this.scroller.scrollTop(scrollPos);
|
this.scroller.scrollTop(scrollPos);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -869,6 +898,7 @@ define([
|
||||||
arrowPosY = Math.min(arrowPosY, outerHeight - this.arrow.margin - this.arrow.height);
|
arrowPosY = Math.min(arrowPosY, outerHeight - this.arrow.margin - this.arrow.height);
|
||||||
|
|
||||||
arrowView.css({top: arrowPosY + 'px'});
|
arrowView.css({top: arrowPosY + 'px'});
|
||||||
|
arrowView.removeClass('hidden');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -880,6 +910,23 @@ define([
|
||||||
this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: true});
|
this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: true});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isOverCursor: function() {
|
||||||
|
if (!this.api.asc_GetSelectionBounds) return;
|
||||||
|
|
||||||
|
var p = this.api.asc_GetSelectionBounds(),
|
||||||
|
isCursor = Math.abs(p[0][0] - p[1][0])<0.1 && Math.abs(p[0][1] - p[1][1])<0.1 && Math.abs(p[2][0] - p[3][0])<0.1 && Math.abs(p[2][1] - p[3][1])<0.1;
|
||||||
|
var x0 = p[0][0], y0 = p[0][1],
|
||||||
|
x1 = p[isCursor ? 2 : 1][0], y1 = p[isCursor ? 2 : 1][1];
|
||||||
|
var leftPos = parseInt(this.$window.css('left'))-25,
|
||||||
|
windowWidth = this.$window.outerWidth();
|
||||||
|
if (x0>leftPos && x0<leftPos+windowWidth || x1>leftPos && x1<leftPos+windowWidth) {
|
||||||
|
var newTopDown = Math.max(y0, y1),// try move down
|
||||||
|
newTopUp = Math.min(y0, y1); // try move up
|
||||||
|
return [newTopUp, newTopDown];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
saveText: function (clear) {
|
saveText: function (clear) {
|
||||||
if (this.commentsView && this.commentsView.cmpEl.find('.lock-area').length < 1) {
|
if (this.commentsView && this.commentsView.cmpEl.find('.lock-area').length < 1) {
|
||||||
this.textVal = undefined;
|
this.textVal = undefined;
|
||||||
|
|
Loading…
Reference in a new issue