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

RelationshipChart: make maxImages configurable #524

Merged
Merged
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
2 changes: 2 additions & 0 deletions src/components/GrampsjsRelationshipChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class GrampsjsRelationshipChart extends GrampsjsChartBase {
return {
grampsId: {type: String},
nAnc: {type: Number},
nMaxImages: {type: Number},
gapX: {type: Number},
}
}
Expand All @@ -56,6 +57,7 @@ class GrampsjsRelationshipChart extends GrampsjsChartBase {
return html`
${RelationshipChart(this.data, {
nAnc: this.nAnc,
maxImages: this.nMaxImages,
grampsId: this.grampsId,
getImageUrl: d => getImageUrl(d?.data || {}, 200),
gapX: this.gapX,
Expand Down
2 changes: 2 additions & 0 deletions src/views/GrampsjsViewRelationshipChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class GrampsjsViewRelationshipChart extends GrampsjsViewTreeChartBase {
super()
this.nAnc = 2
this._setSep = true
this._setMaxImages = true
this.color = ''
}

Expand All @@ -43,6 +44,7 @@ export class GrampsjsViewRelationshipChart extends GrampsjsViewTreeChartBase {
<grampsjs-relationship-chart
grampsId=${this.grampsId}
nAnc=${this.nAnc + 1}
nMaxImages=${this.nMaxImages}
.data=${this._data}
>
</grampsjs-relationship-chart>
Expand Down
30 changes: 28 additions & 2 deletions src/views/GrampsjsViewTreeChartBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class GrampsjsViewTreeChartBase extends GrampsjsView {
}

#menu-controls mwc-textfield {
width: 4em;
width: 6em;
}
`,
]
Expand All @@ -55,9 +55,11 @@ export class GrampsjsViewTreeChartBase extends GrampsjsView {
disableHome: {type: Boolean},
nAnc: {type: Number},
nDesc: {type: Number},
nMaxImages: {type: Number},
_data: {type: Array},
_setAnc: {type: Boolean},
_setDesc: {type: Boolean},
_setMaxImages: {type: Boolean},
}
}

Expand All @@ -66,12 +68,14 @@ export class GrampsjsViewTreeChartBase extends GrampsjsView {
this.grampsId = ''
this.nAnc = 3
this.nDesc = 1
this.nMaxImages = 50
this.disableBack = false
this.disableHome = false
this._data = []
this._setAnc = false
this._setDesc = false
this._setSep = false
this._setMaxImages = false
}

renderContent() {
Expand Down Expand Up @@ -176,6 +180,23 @@ export class GrampsjsViewTreeChartBase extends GrampsjsView {
</tr>
`
: ''
}${
this._setMaxImages
? html`
<tr>
<td>${this._('Max Number of Images displayed')}</td>
<td>
<mwc-textfield
value=${this.nMaxImages}
type="number"
min="0"
size="5"
@change=${this._handleChangeMaxImages}
></mwc-textfield>
</td>
</tr>
`
: ''
}
</table>
<mwc-button slot="primaryAction" dialogAction="close"
Expand Down Expand Up @@ -208,7 +229,8 @@ export class GrampsjsViewTreeChartBase extends GrampsjsView {
if (
changed.has('grampsId') ||
changed.has('nAnc') ||
changed.has('nDesc')
changed.has('nDesc') ||
changed.has('nMaxImages')
) {
this._fetchData(this.grampsId)
}
Expand Down Expand Up @@ -267,6 +289,10 @@ export class GrampsjsViewTreeChartBase extends GrampsjsView {
this.nDesc = parseInt(e.target.value, 10)
}

_handleChangeMaxImages(e) {
this.nMaxImages = parseInt(e.target.value, 10)
}

_openMenuControls() {
const menu = this.shadowRoot.getElementById('menu-controls')
menu.open = true
Expand Down
Loading