aboutsummaryrefslogtreecommitdiff
path: root/src/App.vue
diff options
context:
space:
mode:
Diffstat (limited to 'src/App.vue')
-rw-r--r--src/App.vue44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/App.vue b/src/App.vue
index 10537d6..7e5518d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -3,18 +3,52 @@ import tol from './tol.json';
export default {
data() {
return {
- tol: tol,
- tiles: tol.map(e => ({name: e.name}))
+ drawnTol: tol.map(e => ({...e, children:[]})),
+ mode: 'row'
+ }
+ },
+ computed: {
+ tiles(){
+ //minSize, maxSize,
+ let nodes = this.drawnTol;
+ let width = document.documentElement.clientWidth;
+ let height = document.documentElement.clientHeight;
+ let spacing = 5;
+ if (this.mode == 'row'){
+ return nodes.map((el, idx) => ({
+ name: el.name,
+ x: idx*((width - spacing) / nodes.length) + spacing,
+ y: spacing,
+ w: ((width - spacing) / nodes.length) - spacing,
+ h: ((width - spacing) / nodes.length) - spacing,
+ }));
+ } else if (this.mode == 'col'){
+ return nodes.map((el, idx) => ({
+ name: el.name,
+ x: spacing,
+ y: idx*((height - spacing) / nodes.length) + spacing,
+ w: ((height - spacing) / nodes.length) - spacing,
+ h: ((height - spacing) / nodes.length) - spacing,
+ }));
+ }
+ }
+ },
+ methods: {
+ toggleMode(){
+ this.mode = this.mode == 'row' ? 'col' : 'row';
}
}
}
</script>
<template>
- <div class="bg-black flex flex-row flex-wrap justify-center">
+ <div class="bg-black h-[100vh]">
<img v-for="tile in tiles" :src="'/src/assets/' + tile.name + '.jpg'" :alt="tile.name" :id="tile.name"
- @click="$event.target.style.transform = 'translate(20%,30%)'"
- class="m-1 flex-auto transition-transform duration-300"/>
+ :width="tile.w" :height="tile.h"
+ :style="{position: 'absolute', left: tile.x + 'px', top: tile.y + 'px'}"
+ class="transition-all duration-300 ease-out border-2 border-amber-900"
+ @click="toggleMode()"
+ />
</div>
</template>