Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix columnMaxSizes #787

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/react-split-grid/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ class ReactSplitGrid extends React.Component {
if (columnMinSizes !== prevColumnMinSizes) {
needsRecreate = true
}
// TODO use deep equals
if (columnMaxSizes !== prevColumnMaxSizes) {
needsRecreate = true
}

if (rowMinSizes !== prevRowMinSizes) {
needsRecreate = true
Expand All @@ -94,8 +98,9 @@ class ReactSplitGrid extends React.Component {
// Destroy and re-create split if options changed
if (needsRecreate) {
options.columnMinSizes = columnMinSizes
options.columnMaxSizes = columnMaxSizes
options.rowMinSizes = rowMinSizes

options.rowMaxSizes = rowMaxSizes
this.split.destroy(false)

this.split = Split(options)
Expand Down
8 changes: 8 additions & 0 deletions packages/split-grid/src/Gutter.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,14 @@ class Gutter {
bTrackSize = this.minSizeEnd
}

if (aTrackSize > this.maxSizeStart) {
aTrackSize = this.maxSizeStart;
}

if (bTrackSize > this.maxSizeEnd) {
bTrackSize = this.maxSizeEnd;
}

if (this.trackValues[this.aTrack].type === 'px') {
this.tracks[this.aTrack] = `${aTrackSize}px`
} else if (this.trackValues[this.aTrack].type === 'fr') {
Expand Down