Reduce item tree row spacing

This matches the previous tree on macOS.
This commit is contained in:
Dan Stillman 2021-08-21 05:56:56 -04:00
parent 7ef7943a17
commit adb8aa39f8
2 changed files with 6 additions and 4 deletions

View file

@ -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;
}

View file

@ -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,