Browse Source

fix not being able to remove transition

pull/1232/head
Keviin Åberg Kultalahti 5 years ago
parent
commit
b36d4c8a76
  1. 4
      packages/builder/src/builderStore/store/frontend.js
  2. 12
      packages/client/src/utils/transition.js

4
packages/builder/src/builderStore/store/frontend.js

@ -488,10 +488,10 @@ export const getFrontendStore = () => {
selected._styles = { normal: {}, hover: {}, active: {} } selected._styles = { normal: {}, hover: {}, active: {} }
await store.actions.preview.saveSelected() await store.actions.preview.saveSelected()
}, },
updateTransition: async (transition) => { updateTransition: async transition => {
const selected = get(selectedComponent) const selected = get(selectedComponent)
if (transition == null || transition === "") { if (transition == null || transition === "") {
selected = "" selected._transition = ""
} else { } else {
selected._transition = transition selected._transition = transition
} }

12
packages/client/src/utils/transition.js

@ -1,4 +1,4 @@
import { fade, blur, slide, fly } from 'svelte/transition' import { fade, blur, slide, fly } from "svelte/transition"
// Default options // Default options
const transitions = new Map([ const transitions = new Map([
@ -8,8 +8,8 @@ const transitions = new Map([
["scale", { tn: slide, opt: {} }], ["scale", { tn: slide, opt: {} }],
["fly", { tn: fly, opt: { y: 80 } }], ["fly", { tn: fly, opt: { y: 80 } }],
]) ])
export default function transition(node, {type, options = {}}) { export default function transition(node, { type, options = {} }) {
const { tn, opt } = transitions.get(type) || {} const { tn, opt } = transitions.get(type) || {}
return tn ? tn(node, {...opt, ...options}) : fade(node, { duration: 0}) return tn ? tn(node, { ...opt, ...options }) : fade(node, { duration: 0 })
} }

Loading…
Cancel
Save