mirror of
https://github.com/umap-project/umap.git
synced 2025-04-30 12:12:36 +02:00
feat: allow to define tooltip size
This commit is contained in:
parent
d0d40cff99
commit
457338f10a
6 changed files with 24 additions and 0 deletions
|
@ -312,6 +312,7 @@ class Feature {
|
||||||
'properties._umap_options.showLabel',
|
'properties._umap_options.showLabel',
|
||||||
'properties._umap_options.labelDirection',
|
'properties._umap_options.labelDirection',
|
||||||
'properties._umap_options.labelInteractive',
|
'properties._umap_options.labelInteractive',
|
||||||
|
'properties._umap_options.labelSize',
|
||||||
'properties._umap_options.outlink',
|
'properties._umap_options.outlink',
|
||||||
'properties._umap_options.outlinkTarget',
|
'properties._umap_options.outlinkTarget',
|
||||||
]
|
]
|
||||||
|
|
|
@ -697,6 +697,7 @@ export class DataLayer {
|
||||||
'options.showLabel',
|
'options.showLabel',
|
||||||
'options.labelDirection',
|
'options.labelDirection',
|
||||||
'options.labelInteractive',
|
'options.labelInteractive',
|
||||||
|
'options.labelSize',
|
||||||
'options.outlinkTarget',
|
'options.outlinkTarget',
|
||||||
'options.interactive',
|
'options.interactive',
|
||||||
]
|
]
|
||||||
|
|
|
@ -69,10 +69,12 @@ const FeatureMixin = {
|
||||||
const displayName = this.feature.getDisplayName(null)
|
const displayName = this.feature.getDisplayName(null)
|
||||||
let showLabel = this.feature.getOption('showLabel')
|
let showLabel = this.feature.getOption('showLabel')
|
||||||
const oldLabelHover = this.feature.getOption('labelHover')
|
const oldLabelHover = this.feature.getOption('labelHover')
|
||||||
|
const size = this.feature.getOption('labelSize')
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
direction: this.feature.getOption('labelDirection'),
|
direction: this.feature.getOption('labelDirection'),
|
||||||
interactive: this.feature.getOption('labelInteractive'),
|
interactive: this.feature.getOption('labelInteractive'),
|
||||||
|
className: `leaflet-tooltip-${size}`,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldLabelHover && showLabel) showLabel = null // Retrocompat.
|
if (oldLabelHover && showLabel) showLabel = null // Retrocompat.
|
||||||
|
|
|
@ -264,6 +264,18 @@ export const SCHEMA = {
|
||||||
label: translate('Label key'),
|
label: translate('Label key'),
|
||||||
inheritable: true,
|
inheritable: true,
|
||||||
},
|
},
|
||||||
|
labelSize: {
|
||||||
|
type: String,
|
||||||
|
impacts: ['data'],
|
||||||
|
label: translate('Label font size'),
|
||||||
|
inheritable: true,
|
||||||
|
choices: [
|
||||||
|
['default', translate('Default')],
|
||||||
|
['medium', translate('Medium')],
|
||||||
|
['big', translate('Big')],
|
||||||
|
],
|
||||||
|
default: 'default',
|
||||||
|
},
|
||||||
licence: {
|
licence: {
|
||||||
type: String,
|
type: String,
|
||||||
impacts: ['ui'],
|
impacts: ['ui'],
|
||||||
|
|
|
@ -1260,6 +1260,7 @@ U.Map = L.Map.extend({
|
||||||
'options.showLabel',
|
'options.showLabel',
|
||||||
'options.labelDirection',
|
'options.labelDirection',
|
||||||
'options.labelInteractive',
|
'options.labelInteractive',
|
||||||
|
'options.labelSize',
|
||||||
'options.outlinkTarget',
|
'options.outlinkTarget',
|
||||||
]
|
]
|
||||||
builder = new U.FormBuilder(this, popupFields)
|
builder = new U.FormBuilder(this, popupFields)
|
||||||
|
|
|
@ -1185,6 +1185,13 @@ span.popup-icon {
|
||||||
.umap-edit-enabled .readonly {
|
.umap-edit-enabled .readonly {
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
.leaflet-tooltip-medium {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.leaflet-tooltip-big {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ********************************* */
|
/* ********************************* */
|
||||||
|
|
Loading…
Reference in a new issue