Fixes #515, Zotero pane min-height remains in effect when pane is closed

Also:

- Changed default Zotero pane min-height to 32px, which lets you shrink it to just the controls -- it would be better if we had a notification popup for the various non-translator save functions, since this way there's no feedback when you click the buttons, but at least it's possible. A dedicated mode with a keyboard shortcut would probably be better.
- Fixed bug (I think) whereby resizing the Z pane downward after resizing the tag selector up and then down sometimes caused the Z pane to stay at a fixed size and get pushed below the bottom
This commit is contained in:
Dan Stillman 2007-01-29 23:16:43 +00:00
parent bbb1236ae8
commit 9197a8b4de
4 changed files with 32 additions and 18 deletions

View File

@ -106,7 +106,7 @@ var ZoteroAdvancedSearch = new function() {
return; return;
} }
if (lastWin.document.getElementById('zotero-pane').getAttribute('collapsed') == 'true') { if (lastWin.document.getElementById('zotero-pane').getAttribute('hidden') == 'true') {
lastWin.ZoteroPane.toggleDisplay(); lastWin.ZoteroPane.toggleDisplay();
} }

View File

@ -89,7 +89,7 @@ var ZoteroPane = new function()
var newPane = document.createElement('hbox'); var newPane = document.createElement('hbox');
newPane.setAttribute('id','zotero-pane'); newPane.setAttribute('id','zotero-pane');
newPane.setAttribute('persist','height'); newPane.setAttribute('persist','height');
newPane.setAttribute('collapsed',true); newPane.setAttribute('hidden', true);
newPane.height = oldPane.height; newPane.height = oldPane.height;
while(oldPane.hasChildNodes()) while(oldPane.hasChildNodes())
newPane.appendChild(oldPane.firstChild); newPane.appendChild(oldPane.firstChild);
@ -98,7 +98,7 @@ var ZoteroPane = new function()
var newSplitter = document.createElement('splitter'); var newSplitter = document.createElement('splitter');
newSplitter.setAttribute('id','zotero-splitter'); newSplitter.setAttribute('id','zotero-splitter');
newSplitter.setAttribute('collapsed',true); newSplitter.setAttribute('hidden', true);
newSplitter.setAttribute('resizebefore','closest'); newSplitter.setAttribute('resizebefore','closest');
newSplitter.setAttribute('resizeafter','closest'); newSplitter.setAttribute('resizeafter','closest');
newSplitter.setAttribute('onmouseup', 'ZoteroPane.updateTagSelectorSize()'); newSplitter.setAttribute('onmouseup', 'ZoteroPane.updateTagSelectorSize()');
@ -168,10 +168,10 @@ var ZoteroPane = new function()
function toggleDisplay() function toggleDisplay()
{ {
// Visible == target visibility // Visible == target visibility
var visible = document.getElementById('zotero-pane').getAttribute('collapsed') == 'true'; var visible = document.getElementById('zotero-pane').getAttribute('hidden') == 'true';
document.getElementById('zotero-pane').setAttribute('collapsed',!visible); document.getElementById('zotero-pane').setAttribute('hidden', !visible);
document.getElementById('zotero-splitter').setAttribute('collapsed',!visible); document.getElementById('zotero-splitter').setAttribute('hidden', !visible);
if (visible) { if (visible) {
document.getElementById('zotero-pane').focus(); document.getElementById('zotero-pane').focus();
@ -191,14 +191,14 @@ var ZoteroPane = new function()
// Turn Z-pane flex on to stretch to window in full-screen, but off otherwise so persist works // Turn Z-pane flex on to stretch to window in full-screen, but off otherwise so persist works
document.getElementById('zotero-pane').setAttribute('flex', collapsed ? "0" : "1"); document.getElementById('zotero-pane').setAttribute('flex', collapsed ? "0" : "1");
document.getElementById('content').setAttribute('collapsed', !collapsed); document.getElementById('content').setAttribute('collapsed', !collapsed);
document.getElementById('zotero-splitter').setAttribute('collapsed', !collapsed); document.getElementById('zotero-splitter').setAttribute('hidden', !collapsed);
document.getElementById('zotero-tb-fullscreen').setAttribute('fullscreenmode', !collapsed); document.getElementById('zotero-tb-fullscreen').setAttribute('fullscreenmode', !collapsed);
} }
function handleKeyPress(event) { function handleKeyPress(event) {
// Ignore keystrokes if Zotero pane is closed // Ignore keystrokes if Zotero pane is closed
if (document.getElementById('zotero-pane').getAttribute('collapsed') == 'true') { if (document.getElementById('zotero-pane').getAttribute('hidden') == 'true') {
return; return;
} }
@ -367,14 +367,28 @@ var ZoteroPane = new function()
zoteroPane.setAttribute('height', zoteroPane.boxObject.height); zoteroPane.setAttribute('height', zoteroPane.boxObject.height);
} }
if (tagSelector.getAttribute('collapsed') != 'true' && !height) { if (tagSelector.getAttribute('collapsed') == 'true') {
height = parseInt(tagSelector.getAttribute('height')); // 32px is the default Z pane min-height in overlay.css
height = 32;
}
else {
// tS.boxObject.height doesn't exist at startup, so get from attribute
if (!height) {
height = parseInt(tagSelector.getAttribute('height'));
}
// 121px seems to be enough room for the toolbar and collections
// tree at minimum height
height = height + 121;
} }
// 170px is the Z-pane min-height sans tag selector; 120px seems to be Zotero.debug('Setting Zotero pane minheight to ' + height);
// enough room for the toolbar and collections tree at minimum height zoteroPane.setAttribute('minheight', height);
//Zotero.debug('Setting tag selector minheight to ' + (Math.max(170, 120 + height)));
zoteroPane.setAttribute('minheight', Math.max(170, 120 + height)); // Fix bug whereby resizing the Z pane downward after resizing
// the tag selector up and then down sometimes caused the Z pane to
// stay at a fixed size and get pushed below the bottom
tagSelector.height++;
tagSelector.height--;
} }

View File

@ -64,9 +64,9 @@
<vbox id="appcontent"> <vbox id="appcontent">
<!-- Changes to attributes of zotero-splitter and zotero-pane must be mirrored on overlay.js's onLoad() function --> <!-- Changes to attributes of zotero-splitter and zotero-pane must be mirrored on overlay.js's onLoad() function -->
<!-- onmouseup shouldn't be necessary but seems to help prevent tag selector from sometimes going off the screen --> <!-- onmouseup shouldn't be necessary but seems to help prevent tag selector from sometimes going off the screen -->
<splitter id="zotero-splitter" resizebefore="closest" resizeafter="closest" collapsed="true" <splitter id="zotero-splitter" resizebefore="closest" resizeafter="closest" hidden="true"
onmouseup="ZoteroPane.updateTagSelectorSize()"/> onmouseup="ZoteroPane.updateTagSelectorSize()"/>
<hbox id="zotero-pane" persist="height" collapsed="true"> <hbox id="zotero-pane" persist="height" hidden="true">
<popupset> <popupset>
<popup id="zotero-collectionmenu" onpopupshowing="ZoteroPane.buildCollectionContextMenu();"> <popup id="zotero-collectionmenu" onpopupshowing="ZoteroPane.buildCollectionContextMenu();">
<menuitem label="&zotero.toolbar.newCollection.label;" oncommand="ZoteroPane.newCollection()"/> <menuitem label="&zotero.toolbar.newCollection.label;" oncommand="ZoteroPane.newCollection()"/>
@ -136,7 +136,7 @@
</tree> </tree>
</vbox> </vbox>
<splitter id="zotero-tags-splitter" onmouseup="ZoteroPane.updateTagSelectorSize()"/> <splitter id="zotero-tags-splitter" onmouseup="ZoteroPane.updateTagSelectorSize()"/>
<zoterotagselector id="zotero-tag-selector" persist="height,collapsed,showAutomaticsvn st" <zoterotagselector id="zotero-tag-selector" persist="height,collapsed,showAutomatic"
oncommand="ZoteroPane.updateTagFilter()"/> oncommand="ZoteroPane.updateTagFilter()"/>
</vbox> </vbox>

View File

@ -20,7 +20,7 @@
#zotero-pane #zotero-pane
{ {
background: #f5f5f5; background: #f5f5f5;
min-height: 170px; min-height: 32px; /* must match value in ZoteroPane.updateTagSelectorSize() */
height: 300px; height: 300px;
padding: 4px; padding: 4px;
overflow: hidden; overflow: hidden;