remove button

main
km0 1 year ago
parent 2674a3cf17
commit af6db808d0

@ -8,6 +8,9 @@
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script type="module" src="src/main.js"></script> <script type="module" src="src/main.js"></script>
</body> </body>
</html> </html>

@ -3,11 +3,7 @@
</template> </template>
<script setup> <script setup>
import AppDraw from './components/AppDraw.vue' import AppDraw from './components/AppDraw.vue'
</script> </script>
<style> <style>

@ -0,0 +1,11 @@
@keyframes grow {
from {
transform: scale(1);
}
to {
transform: scale(1.1);
}
}

@ -3,6 +3,7 @@
<form v-if="editing" class="edit"> <form v-if="editing" class="edit">
<textarea v-model="style"></textarea> <textarea v-model="style"></textarea>
<button @click="edit">Confirm</button> <button @click="edit">Confirm</button>
<button @click.prevent="remove"> X </button>
</form> </form>
@ -26,7 +27,7 @@
import {ref, computed, onMounted} from 'vue' import {ref, computed, onMounted} from 'vue'
let style = ref("color: white; stroke-width: 4px;") let style = ref("color: white; fill: white; stroke-width: 4px;")
const editing = ref(false) const editing = ref(false)
const currentIndex = ref(0) const currentIndex = ref(0)
@ -44,6 +45,11 @@ const select = (p, index) => {
} }
} }
const remove = () => {
paths.value.splice(currentIndex.value, 1)
edit.value = false
}
const container = ref(null) const container = ref(null)
const paths = ref([]) const paths = ref([])
let rect = null let rect = null
@ -158,8 +164,7 @@ const stopDrawing = (e) => {
if (!path) return if (!path) return
path = null path = null
strPath = "" strPath = ""
paths.value[paths.value.length-1].style += " fill: white;"
} }
@ -216,6 +221,10 @@ path {
cursor: pointer; cursor: pointer;
} }
.edit button + button {
margin-left: 8px;
}
.edit button:hover { .edit button:hover {
background-color: white; background-color: white;
color: black; color: black;

@ -1,5 +1,6 @@
import { createApp } from 'vue' import { createApp } from 'vue'
import './style.css' import './style.css'
import './animations.css'
import App from './App.vue' import App from './App.vue'
createApp(App).mount('#app') createApp(App).mount('#app')

Loading…
Cancel
Save