fix(core): set default edge opts before setting elements

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-04-24 00:07:39 +02:00
committed by Braks
parent 8db8dc8fc5
commit e41a66dc2d
+10 -4
View File
@@ -661,8 +661,14 @@ export function useActions(
'translateExtent', 'translateExtent',
'nodeExtent', 'nodeExtent',
'hooks', 'hooks',
'defaultEdgeOptions',
] ]
// we need to set the default opts before setting any elements so the options are applied to the elements on first render
if (isDef(opts.defaultEdgeOptions)) {
state.defaultEdgeOptions = opts.defaultEdgeOptions
}
const elements = opts.modelValue || opts.nodes || opts.edges ? ([] as Elements) : undefined const elements = opts.modelValue || opts.nodes || opts.edges ? ([] as Elements) : undefined
if (elements) { if (elements) {
@@ -682,16 +688,16 @@ export function useActions(
} }
const setSkippedOptions = () => { const setSkippedOptions = () => {
if (typeof opts.maxZoom !== 'undefined') { if (isDef(opts.maxZoom)) {
setMaxZoom(opts.maxZoom) setMaxZoom(opts.maxZoom)
} }
if (typeof opts.minZoom !== 'undefined') { if (isDef(opts.minZoom)) {
setMinZoom(opts.minZoom) setMinZoom(opts.minZoom)
} }
if (typeof opts.translateExtent !== 'undefined') { if (isDef(opts.translateExtent)) {
setTranslateExtent(opts.translateExtent) setTranslateExtent(opts.translateExtent)
} }
if (typeof opts.nodeExtent !== 'undefined') { if (isDef(opts.nodeExtent)) {
setNodeExtent(opts.nodeExtent) setNodeExtent(opts.nodeExtent)
} }
} }