From adb8aa39f800561b3c9f765f9f624aab13f5113a Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 21 Aug 2021 05:56:56 -0400 Subject: [PATCH] Reduce item tree row spacing This matches the previous tree on macOS. --- chrome/content/zotero/components/virtualized-table.jsx | 9 +++++---- chrome/content/zotero/itemTree.jsx | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/components/virtualized-table.jsx b/chrome/content/zotero/components/virtualized-table.jsx index 1f3e4faedb..911b844c1d 100644 --- a/chrome/content/zotero/components/virtualized-table.jsx +++ b/chrome/content/zotero/components/virtualized-table.jsx @@ -33,6 +33,7 @@ const Draggable = require('./draggable'); const { injectIntl } = require('react-intl'); const { IconDownChevron, getDOMElement } = require('components/icons'); +const DEFAULT_ROW_HEIGHT = 20; // px const RESIZER_WIDTH = 5; // px const noop = () => 0; @@ -291,9 +292,9 @@ class VirtualizedTable extends React.Component { this._rowHeight = props.rowHeight; if (!this._rowHeight) { - this._rowHeight = 20; // px + this._rowHeight = props.defaultRowHeight || DEFAULT_ROW_HEIGHT; this._rowHeight *= Zotero.Prefs.get('fontSize'); - if (Zotero.isMac && this._rowHeight > 20) { + if (Zotero.isMac && this._rowHeight > (props.defaultRowHeight || DEFAULT_ROW_HEIGHT)) { this._rowHeight -= 2; } } @@ -1061,9 +1062,9 @@ class VirtualizedTable extends React.Component { Zotero.debug("Attempting to update virtualized-table font size with a prop-specified rowHeight." + "You should change the prop on the React component instead"); } - this._rowHeight = 20; // px + this._rowHeight = this.props.defaultRowHeight || DEFAULT_ROW_HEIGHT; this._rowHeight *= Zotero.Prefs.get('fontSize'); - if (Zotero.isMac && this._rowHeight > 20) { + if (Zotero.isMac && this._rowHeight > (this.props.defaultRowHeight || DEFAULT_ROW_HEIGHT)) { this._rowHeight -= 2; } diff --git a/chrome/content/zotero/itemTree.jsx b/chrome/content/zotero/itemTree.jsx index 004cccc404..5894de42d8 100644 --- a/chrome/content/zotero/itemTree.jsx +++ b/chrome/content/zotero/itemTree.jsx @@ -1125,6 +1125,7 @@ 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,