Unverified Commit 3271b4e0 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera
Browse files

feat: add props merger, remove setOptions

parent 1f8ba526
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ export const capitalizeFirstLetter = (string) => {
  return string.charAt(0).toUpperCase() + string.slice(1);
};

export const propsBinder = (methods, leafletElement, props, setOptions) => {
export const propsBinder = (methods, leafletElement, props) => {
  for (const key in props) {
    const setMethodName = "set" + capitalizeFirstLetter(key);
    if (methods[setMethodName]) {
@@ -32,13 +32,6 @@ export const propsBinder = (methods, leafletElement, props, setOptions) => {
          methods[setMethodName](newVal, oldVal);
        }
      );
    } else if (setMethodName === "setOptions") {
      watch(
        () => props[key],
        (newVal) => {
          setOptions(leafletElement, newVal);
        }
      );
    } else if (leafletElement[setMethodName]) {
      watch(
        () => props[key],
@@ -103,3 +96,7 @@ export const provideLeafletWrapper = (methodName) => {
 */
export const updateLeafletWrapper = (wrapper, leafletMethod) =>
  (wrapper.wrapped.value = leafletMethod);

export const optionsMerger = (options, props) => {
  return { ...options, ...props.options, options: undefined };
};