Skip to content

Commit

Permalink
Fix effect clicking
Browse files Browse the repository at this point in the history
All effects except inputs can now be clicked
  • Loading branch information
jolaleye committed May 9, 2019
1 parent 8a7a6fb commit d459123
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
17 changes: 16 additions & 1 deletion components/BaseEffect.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
<template>
<div class="box" v-on:click.self="$emit('inspect')">
<div class="box" ref="box" v-on:click="inspect">
<slot></slot>
</div>
</template>

<script>
export default {
props: ["type"],
methods: {
inspect(e) {
const self = this.$refs.box === e.target;
// don't accept clicks on an input
if (this.type === "input" && !self) return;
this.$emit("inspect");
}
}
};
</script>


<style lang="scss" scoped>
.box {
display: flex;
Expand Down
9 changes: 5 additions & 4 deletions components/EffectGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
<Controls v-on:shuffle="shuffle" v-on:reset="reset" v-on:filter="filter"/>
<transition-group class="grid" name="shuffle" tag="div">
<BaseEffect
v-for="effectName in Object.keys(this.effects)"
v-bind:key="effectName"
v-on:inspect="$emit('inspect', effectName)"
v-for="effect in Object.entries(this.effects)"
v-bind:key="effect[0]"
v-on:inspect="$emit('inspect', effect[0])"
v-bind:type="effect[1].type"
>
<component v-bind:is="effectName"></component>
<component v-bind:is="effect[0]"></component>
</BaseEffect>
</transition-group>
</div>
Expand Down

0 comments on commit d459123

Please sign in to comment.