2021-06-20 23:29:55 -05:00
|
|
|
<template>
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
<button @click.stop="click" class="feedback" :class="{ activated, left }">
|
|
|
|
<slot />
|
|
|
|
</button>
|
2021-06-20 23:29:55 -05:00
|
|
|
</template>
|
|
|
|
|
2022-01-13 22:25:47 -06:00
|
|
|
<script setup lang="ts">
|
2022-01-24 22:25:34 -06:00
|
|
|
import { nextTick, ref } from "vue";
|
2021-06-20 23:29:55 -05:00
|
|
|
|
2022-01-24 22:25:34 -06:00
|
|
|
defineProps<{
|
|
|
|
left?: boolean;
|
|
|
|
}>();
|
2022-01-13 22:25:47 -06:00
|
|
|
const emit = defineEmits<{
|
|
|
|
(e: "click"): void;
|
|
|
|
}>();
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
|
2022-01-13 22:25:47 -06:00
|
|
|
const activated = ref(false);
|
2024-10-18 09:26:10 -05:00
|
|
|
const activatedTimeout = ref<NodeJS.Timeout | null>(null);
|
2022-01-13 22:25:47 -06:00
|
|
|
|
|
|
|
function click() {
|
|
|
|
emit("click");
|
|
|
|
|
|
|
|
// Give feedback to user
|
2024-10-18 09:26:10 -05:00
|
|
|
if (activatedTimeout.value != null) {
|
2022-01-13 22:25:47 -06:00
|
|
|
clearTimeout(activatedTimeout.value);
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
}
|
2022-01-13 22:25:47 -06:00
|
|
|
activated.value = false;
|
|
|
|
nextTick(() => {
|
|
|
|
activated.value = true;
|
|
|
|
activatedTimeout.value = setTimeout(() => (activated.value = false), 500);
|
|
|
|
});
|
|
|
|
}
|
2021-06-20 23:29:55 -05:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.feedback {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
position: relative;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.feedback::after {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
position: absolute;
|
|
|
|
left: calc(100% + 5px);
|
|
|
|
top: 50%;
|
|
|
|
transform: translateY(-50%);
|
|
|
|
content: "✔";
|
|
|
|
opacity: 0;
|
|
|
|
pointer-events: none;
|
|
|
|
box-shadow: inset 0 0 0 35px rgba(111, 148, 182, 0);
|
|
|
|
text-shadow: none;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.feedback.left::after {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
left: unset;
|
|
|
|
right: calc(100% + 5px);
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.feedback.activated::after {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
animation: feedback 0.5s ease-out forwards;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes feedback {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
0% {
|
|
|
|
opacity: 1;
|
|
|
|
transform: scale3d(0.4, 0.4, 1), translateY(-50%);
|
|
|
|
}
|
|
|
|
80% {
|
|
|
|
opacity: 0.1;
|
|
|
|
}
|
|
|
|
100% {
|
|
|
|
opacity: 0;
|
|
|
|
transform: scale3d(1.2, 1.2, 1), translateY(-50%);
|
|
|
|
}
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
</style>
|