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

feat: allow to define tooltip size #2187

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
1 change: 1 addition & 0 deletions umap/static/umap/js/modules/data/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ class Feature {
'properties._umap_options.showLabel',
'properties._umap_options.labelDirection',
'properties._umap_options.labelInteractive',
'properties._umap_options.labelImportance',
'properties._umap_options.outlink',
'properties._umap_options.outlinkTarget',
]
Expand Down
1 change: 1 addition & 0 deletions umap/static/umap/js/modules/data/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ export class DataLayer {
'options.showLabel',
'options.labelDirection',
'options.labelInteractive',
'options.labelImportance',
'options.outlinkTarget',
'options.interactive',
]
Expand Down
2 changes: 2 additions & 0 deletions umap/static/umap/js/modules/rendering/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ const FeatureMixin = {
const displayName = this.feature.getDisplayName(null)
let showLabel = this.feature.getOption('showLabel')
const oldLabelHover = this.feature.getOption('labelHover')
const importance = this.feature.getOption('labelImportance')

const options = {
direction: this.feature.getOption('labelDirection'),
interactive: this.feature.getOption('labelInteractive'),
className: `leaflet-tooltip-${importance}`,
}

if (oldLabelHover && showLabel) showLabel = null // Retrocompat.
Expand Down
12 changes: 12 additions & 0 deletions umap/static/umap/js/modules/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,18 @@ export const SCHEMA = {
],
default: 'auto',
},
labelImportance: {
type: String,
impacts: ['data'],
label: translate('Label importance'),
inheritable: true,
choices: [
['low', translate('Default')],
['medium', translate('Medium')],
['high', translate('High')],
],
default: 'low',
},
labelInteractive: {
type: Boolean,
impacts: ['data'],
Expand Down
1 change: 1 addition & 0 deletions umap/static/umap/js/umap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,7 @@ U.Map = L.Map.extend({
'options.showLabel',
'options.labelDirection',
'options.labelInteractive',
'options.labelImportance',
'options.outlinkTarget',
]
builder = new U.FormBuilder(this, popupFields)
Expand Down
7 changes: 7 additions & 0 deletions umap/static/umap/map.css
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,13 @@ span.popup-icon {
.umap-edit-enabled .readonly {
cursor: not-allowed;
}
.leaflet-tooltip-medium {
font-weight: bold;
}
.leaflet-tooltip-high {
font-weight: bold;
font-size: 1.2rem;
}


/* ********************************* */
Expand Down