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