diff --git a/package.json b/package.json
index 9c86aab..40f85e2 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
"@types/ws": "^7.2.7",
"animejs": "^3.2.0",
"core-js": "^3.6.5",
+ "mitt": "^2.1.0",
"speech-recorder": "^1.2.1",
"vue": "^3.0.0-0",
"vue-router": "^4.0.0-0",
diff --git a/src/components/UI/UIDetails/inputItem.vue b/src/components/UI/UIDetails/inputItem.vue
index 338c707..87c9380 100644
--- a/src/components/UI/UIDetails/inputItem.vue
+++ b/src/components/UI/UIDetails/inputItem.vue
@@ -1,68 +1,70 @@
-
+
+
+
diff --git a/src/composables/useTextBox.ts b/src/composables/useTextBox.ts
index e69de29..e10821f 100644
--- a/src/composables/useTextBox.ts
+++ b/src/composables/useTextBox.ts
@@ -0,0 +1,31 @@
+import { reactive, onMounted } from "vue";
+export default function useTextBox() {
+ const textArr: string[] = reactive([]);
+
+ function createTextBox(s: string, w: number): string[] {
+ // return tspan elements for text with correct size
+ const wrap = (s: string, w: number) =>
+ s.replace(
+ new RegExp(`(?![^\\n]{1,${w}}$)([^\\n]{1,${w}})\\s`, "g"),
+ "$1\n"
+ );
+ const textWrap = wrap(s, w).split("\n");
+ return textWrap;
+ }
+
+ function adjustRect(rect: any, text: any): void {
+ // must get dimensions of text box to fit bubble around
+ const padding = 20;
+ const bbox = text.getBBox();
+ rect.setAttribute("x", bbox.x - padding);
+ rect.setAttribute("y", bbox.y - padding);
+ rect.setAttribute("width", bbox.width + 2 * padding);
+ rect.setAttribute("height", bbox.height + 2 * padding);
+ }
+
+ return {
+ textArr,
+ adjustRect,
+ createTextBox
+ };
+}
diff --git a/src/main.ts b/src/main.ts
index a04047e..bc2fa9d 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -2,10 +2,17 @@ import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
+
+// animation library
import anime from "animejs";
+// event handler library
+import mitt from "mitt";
+const emitter = mitt();
+
createApp(App)
.use(store)
.use(router)
.provide("animejs", anime)
+ .provide("mitt", emitter)
.mount("#app");
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index d20f308..dc8b768 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -6,7 +6,7 @@
diff --git a/yarn.lock b/yarn.lock
index 8d2a5a4..82f9910 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -8569,6 +8569,11 @@ mississippi@^3.0.0:
stream-each "^1.1.0"
through2 "^2.0.0"
+mitt@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/mitt/-/mitt-2.1.0.tgz#f740577c23176c6205b121b2973514eade1b2230"
+ integrity sha512-ILj2TpLiysu2wkBbWjAmww7TkZb65aiQO+DkVdUTBpBXq+MHYiETENkKFMtsJZX1Lf4pe4QOrTSjIfUwN5lRdg==
+
mixin-deep@^1.2.0:
version "1.3.2"
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566"