From c631afc87e1f725e87e5fdc4e3bb32cd6e6dc119 Mon Sep 17 00:00:00 2001 From: Alexandru Ariton Date: Tue, 16 Jan 2024 20:11:28 +0200 Subject: [PATCH 1/2] Changed some ui bugs --- .idea/.gitignore | 8 ++ .idea/Camacho.iml | 10 ++ .idea/inspectionProfiles/Project_Default.xml | 23 ++++ .../inspectionProfiles/profiles_settings.xml | 6 + .idea/modules.xml | 8 ++ .idea/vcs.xml | 6 + book/chattutor_setup/chattutor.config.js | 2 +- book/chattutor_setup/chattutor.min.js | 70 ++++++++--- book/chattutor_setup/chattutor.style.css | 116 +++++++++++++----- 9 files changed, 203 insertions(+), 46 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/Camacho.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/Camacho.iml b/.idea/Camacho.iml new file mode 100644 index 0000000..5e4d7e7 --- /dev/null +++ b/.idea/Camacho.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..2f73736 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,23 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..5b6dcee --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/book/chattutor_setup/chattutor.config.js b/book/chattutor_setup/chattutor.config.js index 138766c..d1fa199 100644 --- a/book/chattutor_setup/chattutor.config.js +++ b/book/chattutor_setup/chattutor.config.js @@ -48,7 +48,7 @@ * file, false if ran on a server, either local or online * Usually true for jupyter books */ -const RUN_LOCALLY = false; +const RUN_LOCALLY = true; const TEST_MODE = false; const IS_STATIC = true; diff --git a/book/chattutor_setup/chattutor.min.js b/book/chattutor_setup/chattutor.min.js index bf31cbd..d8810a4 100644 --- a/book/chattutor_setup/chattutor.min.js +++ b/book/chattutor_setup/chattutor.min.js @@ -1,16 +1,49 @@ var global_movex = 0; var global_movey = 0; +var should_move = true function setupEmbedMode_URL() { var reader = new FileReader(); const charttutor_embed_elemment_andu = document.createElement("div") + // charttutor_embed_elemment_andu.setAttribute("style", "position: fixed; z-index: 2147483646;") + // charttutor_embed_elemment_andu.innerHTML = `
${chattutor_embed}
` + // document.body.append(charttutor_embed_elemment_andu) + // const container = document.getElementById("idallchattutor"); + // const movecontainer = document.getElementById("moveidallchattutor"); + // + // function onMouseDrag(e) { + // e.preventDefault() + // const movementX = e.movementX + // const movementY = e.movementY + // global_movex += movementX; + // global_movey += movementY; + // movecontainer.style.transition = "none" + // movecontainer.style.animation = "none" + // + // movecontainer.style.transform = `translate(${global_movex}px, ${global_movey}px)`; + // // container.style.backgroundColor = `red`; + // // console.log(container.style.transform) + // // console.log(container.style.backgroundColor) + // // console.log("hehehe", movementX, movementY) + // } + // + // container.addEventListener("mousedown", () => { + // document.addEventListener("mousemove", onMouseDrag); + // }); + // document.addEventListener("mouseup", () => { + // document.removeEventListener("mousemove", onMouseDrag); + // }); charttutor_embed_elemment_andu.setAttribute("style", "position: fixed; z-index: 2147483646;") - charttutor_embed_elemment_andu.innerHTML = `
${chattutor_embed}
` + charttutor_embed_elemment_andu.innerHTML = `
${chattutor_embed}
` document.body.append(charttutor_embed_elemment_andu) - const container = document.getElementById("idallchattutor"); + const container = document.getElementById("move-andu"); const movecontainer = document.getElementById("moveidallchattutor"); + const movecontainer2 = document.getElementById("msgInputDiv"); function onMouseDrag(e) { + if(!should_move) { + return + } e.preventDefault() const movementX = e.movementX const movementY = e.movementY @@ -18,21 +51,28 @@ function setupEmbedMode_URL() { global_movey += movementY; movecontainer.style.transition = "none" movecontainer.style.animation = "none" - + movecontainer.style.scale = "unset" movecontainer.style.transform = `translate(${global_movex}px, ${global_movey}px)`; - // container.style.backgroundColor = `red`; - // console.log(container.style.transform) - // console.log(container.style.backgroundColor) - // console.log("hehehe", movementX, movementY) } container.addEventListener("mousedown", () => { document.addEventListener("mousemove", onMouseDrag); }); + document.addEventListener("mouseup", () => { document.removeEventListener("mousemove", onMouseDrag); + movecontainer.style.transition = "all 0.2s ease" + // movecontainer2.style.transition = "all 0.2s ease" }); + movecontainer2.addEventListener('mouseenter', () => { + should_move = false + }) + + movecontainer2.addEventListener('mouseleave', () => { + should_move = true + }) + console.log(window.location) let path = window.location.pathname @@ -74,22 +114,22 @@ let chattutor_embed = `
-
+
-
+
- +
+ + +
ChatTutor Add URL -
-
- -
+