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

View file

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