Skip to content
Snippets Groups Projects
Commit 4086d3eb authored by Toby Milner-Gulland's avatar Toby Milner-Gulland
Browse files

playing around with separate store

parent 111c1a82
No related branches found
No related tags found
No related merge requests found
<template> <template>
<div id="app"> <div id="app">
<div id="nav"> <navigation />
<navigation/>
</div>
<router-view /> <router-view />
</div> </div>
</template> </template>
...@@ -23,11 +21,25 @@ export default { ...@@ -23,11 +21,25 @@ export default {
</script> </script>
<style> <style>
@import url('https://rsms.me/inter/inter.css'); @import url('https://rsms.me/inter/inter.css');
body {
padding: 0;
margin: 0;
}
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
#app { #app {
font-family: 'Inter var', Helvetica, sans-serif; font-family: 'Inter var', Helvetica, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
padding-top: 40px;
} }
h1 { h1 {
......
...@@ -29,6 +29,7 @@ nav { ...@@ -29,6 +29,7 @@ nav {
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
padding: 10px; padding: 10px;
height: 40px;
} }
nav a { nav a {
font-weight: bold; font-weight: bold;
......
...@@ -10,38 +10,31 @@ ...@@ -10,38 +10,31 @@
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
border: 5px solid red;
} }
.inner { .inner {
width: 2000px; width: 2000px;
height: 2000px; height: 2000px;
background-color: rgb(50, 50, 50);
background-image: linear-gradient(
0deg,
transparent 24%,
rgba(255, 255, 255, 0.05) 25%,
rgba(255, 255, 255, 0.05) 26%,
transparent 27%,
transparent 74%,
rgba(255, 255, 255, 0.05) 75%,
rgba(255, 255, 255, 0.05) 76%,
transparent 77%,
transparent
),
linear-gradient(
90deg,
transparent 24%,
rgba(255, 255, 255, 0.05) 25%,
rgba(255, 255, 255, 0.05) 26%,
transparent 27%,
transparent 74%,
rgba(255, 255, 255, 0.05) 75%,
rgba(255, 255, 255, 0.05) 76%,
transparent 77%,
transparent
);
position: relative; position: relative;
transform-origin: 0 0; transform-origin: 0 0;
background-size: 40px 40px;
background-color: rgb(245, 245, 245);
background-image: radial-gradient(
circle,
rgba(0, 0, 0, 0.5) 1px,
rgba(0, 0, 0, 0) 1px
);
}
.indicator {
position: absolute;
z-index: 4;
top: 20px;
right: 20px;
font-size: 12px;
color: white;
padding: 10px;
border-radius: 3px;
background: rgb(50, 50, 50);
} }
</style> </style>
...@@ -64,11 +57,14 @@ ...@@ -64,11 +57,14 @@
<div <div
class="inner" class="inner"
v-bind:style="{ v-bind:style="{
width: `${width}px`,
height: `${height}px`,
transform: `translate(${translation.x}px, ${translation.y}px) scale(${scale})` transform: `translate(${translation.x}px, ${translation.y}px) scale(${scale})`
}" }"
> >
<slot></slot> <slot></slot>
</div> </div>
<div class="indicator">{{ scalePercentage }}</div>
</div> </div>
</template> </template>
<script> <script>
...@@ -125,16 +121,23 @@ export default { ...@@ -125,16 +121,23 @@ export default {
translationBounds: { translationBounds: {
type: Object, type: Object,
default() { default() {
return { xMin: -1000, xMax: 1000, yMin: -1000, yMax: 1000 } return { xMin: -500, xMax: 500, yMin: -500, yMax: 500 }
} }
}, },
width: Number,
height: Number,
minScale: { minScale: {
type: Number, type: Number,
default: 0.05 default: 0.3
}, },
maxScale: { maxScale: {
type: Number, type: Number,
default: 3.0 default: 2.0
}
},
computed: {
scalePercentage() {
return `${(this.scale * 100).toFixed(0)}%`
} }
}, },
methods: { methods: {
......
const store = new Vuex.Store({
namespaced: true,
state: {
count: 1
},
mutations: {
increment (state) {
// mutate state
state.count++
}
}
})
<template> <template>
<div class="container"> <pzc v-bind:width="2000" v-bind:height="2000">
<pzc> <h1>Inner</h1>
<div class="board">Inner</div> </pzc>
</pzc>
</div>
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import PanZoomContainer from '../experimental/PanZoomContainer' import PanZoomContainer from '../experimental/PanZoomContainer'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment