A true platform-general solution to the panel sizing problem

This commit is contained in:
Simon Kornblith 2012-01-17 00:31:43 -05:00
parent 6750535319
commit bbd686f8bb

View File

@ -24,6 +24,7 @@
*/
var Zotero_QuickFormat = new function () {
const pixelRe = /^([0-9]+)px$/
var initialized, io, qfs, qfi, qfiWindow, qfiDocument, qfe, qfb, qfbHeight, keepSorted,
showEditor, referencePanel, referenceBox, referenceHeight = 0, separatorHeight = 0,
currentLocator, currentLocatorLabel, currentSearchTime, dragging, panel,
@ -741,15 +742,19 @@ var Zotero_QuickFormat = new function () {
}
if(!panelFrameHeight) {
if(Zotero.isWin || Zotero.isMac) {
panelFrameHeight = 1;
} else {
panelFrameHeight = referencePanel.boxObject.height - referencePanel.clientHeight;
panelFrameHeight = referencePanel.boxObject.height - referencePanel.clientHeight;
var computedStyle = window.getComputedStyle(referenceBox, null);
for each(var attr in ["border-top-width", "border-bottom-width"]) {
var val = computedStyle.getPropertyValue(attr);
if(val) {
var m = pixelRe.exec(val);
if(m) panelFrameHeight += parseInt(m[1], 10);
}
}
}
referencePanel.sizeTo(window.outerWidth-30,
numReferences*referenceHeight+numSeparators*separatorHeight+2*panelFrameHeight);
numReferences*referenceHeight+numSeparators*separatorHeight+panelFrameHeight);
if(!panelShowing) _openReferencePanel();
} else if(panelShowing) {
referencePanel.hidePopup();