diff --git a/chrome/content/zotero/collectionTree.jsx b/chrome/content/zotero/collectionTree.jsx index c460a62673..52f0e8e790 100644 --- a/chrome/content/zotero/collectionTree.jsx +++ b/chrome/content/zotero/collectionTree.jsx @@ -373,6 +373,8 @@ var CollectionTree = class CollectionTree extends LibraryTree { ref: ref => this.tree = ref, treeboxRef: ref => this._treebox = ref, renderItem: this.renderItem, + // Extra space on macOS (which gets reduced by 2, so this really means 20) + ...(Zotero.isMac && { rowHeight: 22 }), onSelectionChange: this._handleSelectionChange, isSelectable: this.isSelectable, diff --git a/chrome/content/zotero/components/virtualized-table.jsx b/chrome/content/zotero/components/virtualized-table.jsx index 3ad8689cec..eec44f078e 100644 --- a/chrome/content/zotero/components/virtualized-table.jsx +++ b/chrome/content/zotero/components/virtualized-table.jsx @@ -290,15 +290,15 @@ class VirtualizedTable extends React.Component { this._columns = new Columns(this); - this._rowHeight = props.rowHeight; - if (!this._rowHeight) { - this._rowHeight = props.defaultRowHeight || DEFAULT_ROW_HEIGHT; + this._rowHeight = props.rowHeight || DEFAULT_ROW_HEIGHT; + if (!props.disableFontSizeScaling) { this._rowHeight *= Zotero.Prefs.get('fontSize'); - if (Zotero.isMac && this._rowHeight > (props.defaultRowHeight || DEFAULT_ROW_HEIGHT)) { - this._rowHeight -= 2; - } } - + // A bit less row spacing on macOS + if (Zotero.isMac && this._rowHeight >= (props.rowHeight || DEFAULT_ROW_HEIGHT)) { + this._rowHeight -= 2; + } + this.selection = new TreeSelection(this); @@ -367,6 +367,8 @@ class VirtualizedTable extends React.Component { renderItem: PropTypes.func, rowHeight: PropTypes.number, + // Use rowHeight or default row height without adjusting for current UI font size + disableFontSizeScaling: PropTypes.bool, // An array of two elements for alternating row colors alternatingRowColors: PropTypes.array, // For screen-readers @@ -1058,16 +1060,17 @@ class VirtualizedTable extends React.Component { } updateFontSize = () => { - if (typeof this.props.rowHeight == 'number') { - Zotero.debug("Attempting to update virtualized-table font size with a prop-specified rowHeight." - + "You should change the prop on the React component instead"); + if (this.props.disableFontSizeScaling) { + Zotero.warn("Attempting to update font size on a VirtualizedTable with a font scaling " + + "disabled. Change the prop instead."); + return; } - this._rowHeight = this.props.defaultRowHeight || DEFAULT_ROW_HEIGHT; + this._rowHeight = this.props.rowHeight || DEFAULT_ROW_HEIGHT; this._rowHeight *= Zotero.Prefs.get('fontSize'); - if (Zotero.isMac && this._rowHeight > (this.props.defaultRowHeight || DEFAULT_ROW_HEIGHT)) { + if (Zotero.isMac && this._rowHeight >= (this.props.rowHeight || DEFAULT_ROW_HEIGHT)) { this._rowHeight -= 2; } - + if (!this._jsWindow) return; this._jsWindow.update(this._getWindowedListOptions()); this._setAlternatingRows(); diff --git a/chrome/content/zotero/itemTree.jsx b/chrome/content/zotero/itemTree.jsx index f41e9089ab..bf11715b0b 100644 --- a/chrome/content/zotero/itemTree.jsx +++ b/chrome/content/zotero/itemTree.jsx @@ -1130,7 +1130,6 @@ var ItemTree = class ItemTree extends LibraryTree { hide: showMessage, key: "virtualized-table", label: Zotero.getString('pane.items.title'), - defaultRowHeight: 18, // px alternatingRowColors: Zotero.isMac ? ['-moz-OddTreeRow', '-moz-EvenTreeRow'] : null, showHeader: true, diff --git a/chrome/content/zotero/locateManager.jsx b/chrome/content/zotero/locateManager.jsx index db23c20236..74bfc6dfcf 100644 --- a/chrome/content/zotero/locateManager.jsx +++ b/chrome/content/zotero/locateManager.jsx @@ -50,6 +50,7 @@ function init() { showHeader={true} multiSelect={true} columns={columns} + disableFontSizeScaling={true} onActivate={handleActivate} /> diff --git a/chrome/content/zotero/preferences/preferences_cite.jsx b/chrome/content/zotero/preferences/preferences_cite.jsx index ba157e4b7f..f492a6df7f 100644 --- a/chrome/content/zotero/preferences/preferences_cite.jsx +++ b/chrome/content/zotero/preferences/preferences_cite.jsx @@ -126,6 +126,7 @@ Zotero_Preferences.Cite = { multiSelect={true} columns={columns} staticColumns={true} + disableFontSizeScaling={true} onSelectionChange={() => document.getElementById('styleManager-delete').disabled = undefined} onKeyDown={handleKeyDown} /> diff --git a/chrome/content/zotero/preferences/preferences_export.jsx b/chrome/content/zotero/preferences/preferences_export.jsx index 08df9ce3bc..b48b97866e 100644 --- a/chrome/content/zotero/preferences/preferences_export.jsx +++ b/chrome/content/zotero/preferences/preferences_export.jsx @@ -301,6 +301,7 @@ Zotero_Preferences.Export = { showHeader={true} columns={columns} staticColumns={true} + disableFontSizeScaling={true} onSelectionChange={() => Zotero_Preferences.Export.enableQuickCopySiteButtons()} onKeyDown={handleKeyDown} onActivate={(event, indices) => Zotero_Preferences.Export.showQuickCopySiteEditor()} diff --git a/chrome/content/zotero/preferences/preferences_sync.jsx b/chrome/content/zotero/preferences/preferences_sync.jsx index 66edca436b..1fe9a09e9e 100644 --- a/chrome/content/zotero/preferences/preferences_sync.jsx +++ b/chrome/content/zotero/preferences/preferences_sync.jsx @@ -319,6 +319,7 @@ Zotero_Preferences.Sync = { showHeader={true} columns={columns} staticColumns={true} + disableFontSizeScaling={true} onActivate={Zotero_Preferences.Sync.toggleLibraryToSync.bind(this)} onKeyDown={handleKeyDown} /> diff --git a/chrome/content/zotero/progressQueueDialog.jsx b/chrome/content/zotero/progressQueueDialog.jsx index 006a77a98c..6fb018e871 100644 --- a/chrome/content/zotero/progressQueueDialog.jsx +++ b/chrome/content/zotero/progressQueueDialog.jsx @@ -101,6 +101,7 @@ function _init() { renderItem={_rowToTreeItem} showHeader={true} columns={tableColumns} + disableFontSizeScaling={true} onActivate={_handleActivate} /> diff --git a/chrome/content/zotero/rtfScan.jsx b/chrome/content/zotero/rtfScan.jsx index f9f4164a92..c0b3c099cd 100644 --- a/chrome/content/zotero/rtfScan.jsx +++ b/chrome/content/zotero/rtfScan.jsx @@ -775,6 +775,7 @@ var Zotero_RTFScan = new function() { renderItem={this._renderItem} showHeader={true} columns={columns} + disableFontSizeScaling={true} /> );