solve ts conflics in messageAnim compsable

This commit is contained in:
riqo 2020-10-25 15:22:37 -05:00
commit 8717fe9a7d
2 changed files with 9 additions and 9 deletions

View file

@ -10,7 +10,7 @@
</foreignObject>
</template>
<script>
<script lang="ts">
import useKeyDownHandler from "@/composables/keyDownHandler/useKeyDownHandler";
import { defineComponent, onUnmounted } from "vue";
export default defineComponent({

View file

@ -4,22 +4,22 @@ interface Ref {
}
export default function useMessageItemAnims({ mr, tr }: { mr: Ref; tr: Ref }) {
const signatureTranslate = ref("");
let messageRect: string | SVGRectElement | SVGSVGElement | any;
let messageText: string | SVGTextElement | SVGSVGElement | any;
let messageRect: SVGSVGElement & SVGRectElement;
let messageText: SVGSVGElement & SVGTextElement;
onMounted(() => {
messageRect = mr.value;
messageText = tr.value;
messageRect = (mr.value as unknown) as SVGSVGElement & SVGRectElement;
messageText = (tr.value as unknown) as SVGSVGElement & SVGTextElement;
});
function adjustMessageRect(): void {
// must get dimensions of text box to fit bubble around
const padding = 20;
const textBox = messageText.getBBox();
messageRect.setAttribute("x", textBox.x - padding);
messageRect.setAttribute("y", textBox.y - padding);
messageRect.setAttribute("width", textBox.width + 2 * padding);
messageRect.setAttribute("height", textBox.height + 2 * padding);
messageRect.setAttribute("x", String(textBox.x - padding));
messageRect.setAttribute("y", String(textBox.y - padding));
messageRect.setAttribute("width", String(textBox.width + 2 * padding));
messageRect.setAttribute("height", String(textBox.height + 2 * padding));
}
function translateMsgSignature(): void {