Merge pull request #1379 from umap-project/default-props-no-redraw

Keep only non graphic props in default properties, to prevent useless redraw
This commit is contained in:
Yohan Boniface 2023-10-27 09:11:07 +02:00 committed by GitHub
commit 85389699fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1299,11 +1299,13 @@ L.U.Map.include({
'options.fill',
'options.fillColor',
'options.fillOpacity',
'options.smoothFactor',
'options.dashArray',
]
builder = new L.U.FormBuilder(this, shapeOptions, {
callback: function (e) {
this.eachDataLayer((datalayer) => {
this.eachVisibleDataLayer((datalayer) => {
datalayer.redraw()
})
},
@ -1317,8 +1319,6 @@ L.U.Map.include({
_editDefaultProperties: function (container) {
const optionsFields = [
'options.smoothFactor',
'options.dashArray',
'options.zoomTo',
['options.easing', { handler: 'Switch', label: L._('Animated transitions') }],
'options.labelKey',
@ -1365,10 +1365,9 @@ L.U.Map.include({
builder = new L.U.FormBuilder(this, optionsFields, {
callback: function (e) {
this.initCaptionBar()
this.eachDataLayer((datalayer) => {
if (e.helper.field === 'options.sortKey') datalayer.reindex()
datalayer.redraw()
})
if (e.helper.field === 'options.sortKey') {
this.eachDataLayer((datalayer) => datalayer.reindex())
}
},
})
const defaultProperties = L.DomUtil.createFieldset(
@ -1393,10 +1392,11 @@ L.U.Map.include({
if (
e.helper.field === 'options.popupTemplate' ||
e.helper.field === 'options.popupContentTemplate' ||
e.helper.field === 'options.popupShape'
e.helper.field === 'options.popupShape' ||
e.helper.field === 'options.outlinkTarget'
)
return
this.eachDataLayer((datalayer) => {
this.eachVisibleDataLayer((datalayer) => {
datalayer.redraw()
})
},