-
Notifications
You must be signed in to change notification settings - Fork 0
Feedbacks from mati (#97) #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,13 +18,15 @@ const inputLine = defineModel<LineComputeInputLineCoords>('inputLine', { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| defineExpose({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redrawCanvas, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| imageDataURL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cleanImageDataURL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| watch(() => props.uploadedImage, () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initCanvas(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| watch([() => props.traces, inputLine.value], () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redrawCanvas(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void redrawCanvas(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const canvasRef = useTemplateRef<HTMLCanvasElement>('canvasRef'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -45,7 +47,7 @@ function initCanvas() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ctx.value = canvasRef.value?.getContext('2d') || null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redrawCanvas(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await redrawCanvas(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| img.src = URL.createObjectURL(props.uploadedImage); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -90,19 +92,26 @@ function onCanvasMouseUp() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isDrawing.value = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function redrawCanvas() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!canvasRef.value || !ctx.value || !props.uploadedImage) return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function redrawCanvas(withLines: boolean = true) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return new Promise<void>((resolve) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!canvasRef.value || !ctx.value || !props.uploadedImage) return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const img = new Image(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| img.onload = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (ctx.value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ctx.value.clearRect(0, 0, canvasRef.value!.width, canvasRef.value!.height); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ctx.value.drawImage(img, 0, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| drawLine(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| drawResults(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| img.src = URL.createObjectURL(props.uploadedImage); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const img = new Image(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| img.onload = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (ctx.value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ctx.value.clearRect(0, 0, canvasRef.value!.width, canvasRef.value!.height); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ctx.value.drawImage(img, 0, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (withLines) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| drawLine(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| drawResults(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resolve(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| img.src = URL.createObjectURL(props.uploadedImage); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+100
to
+113
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| img.onload = () => { | |
| if (ctx.value) { | |
| ctx.value.clearRect(0, 0, canvasRef.value!.width, canvasRef.value!.height); | |
| ctx.value.drawImage(img, 0, 0); | |
| if (withLines) { | |
| drawLine(); | |
| } | |
| drawResults(); | |
| } | |
| resolve(); | |
| }; | |
| img.src = URL.createObjectURL(props.uploadedImage); | |
| const objectUrl = URL.createObjectURL(props.uploadedImage); | |
| img.onload = () => { | |
| try { | |
| if (ctx.value) { | |
| ctx.value.clearRect(0, 0, canvasRef.value!.width, canvasRef.value!.height); | |
| ctx.value.drawImage(img, 0, 0); | |
| if (withLines) { | |
| drawLine(); | |
| } | |
| drawResults(); | |
| } | |
| } finally { | |
| URL.revokeObjectURL(objectUrl); | |
| resolve(); | |
| } | |
| }; | |
| img.onerror = () => { | |
| URL.revokeObjectURL(objectUrl); | |
| resolve(); | |
| }; | |
| img.src = objectUrl; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,44 @@ | ||||||||||||||||||||||||||
| <template> | ||||||||||||||||||||||||||
| <q-dialog v-model="showDataProtectionNotice"> | ||||||||||||||||||||||||||
| <q-card> | ||||||||||||||||||||||||||
| <q-card-section> | ||||||||||||||||||||||||||
| <div class="text-h6">Masonry Microstructure Database</div> | ||||||||||||||||||||||||||
| </q-card-section> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| <q-card-section> | ||||||||||||||||||||||||||
| <p> | ||||||||||||||||||||||||||
| Welcome to this web-based platform providing open access to realistic 3D microstructures of irregular stone masonry walls. | ||||||||||||||||||||||||||
| </p> | ||||||||||||||||||||||||||
| <p> | ||||||||||||||||||||||||||
| Explore, visualize, and download curated masonry microstructure data and associated geometric descriptors. | ||||||||||||||||||||||||||
| </p> | ||||||||||||||||||||||||||
| <p> | ||||||||||||||||||||||||||
| Welcome aboard! | ||||||||||||||||||||||||||
| </p> | ||||||||||||||||||||||||||
| </q-card-section> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| <q-card-actions> | ||||||||||||||||||||||||||
| <q-toggle v-model="dontShowAgain" label="Do not show again" /> | ||||||||||||||||||||||||||
| </q-card-actions> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| <q-card-actions align="right"> | ||||||||||||||||||||||||||
| <q-btn flat label="Close" color="primary" v-close-popup @click="onClose()" /> | ||||||||||||||||||||||||||
| </q-card-actions> | ||||||||||||||||||||||||||
| </q-card> | ||||||||||||||||||||||||||
| </q-dialog> | ||||||||||||||||||||||||||
| </template> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| <script setup lang="ts"> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| const settings = useSettingsStore(); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| const showDataProtectionNotice = ref(!!settings.settings?.intro_shown); | ||||||||||||||||||||||||||
| const dontShowAgain = ref(false); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| function onClose() { | ||||||||||||||||||||||||||
| if (dontShowAgain.value) { | ||||||||||||||||||||||||||
| settings.saveSettings({ intro_shown: false }) | ||||||||||||||||||||||||||
|
Comment on lines
+35
to
+40
|
||||||||||||||||||||||||||
| const showDataProtectionNotice = ref(!!settings.settings?.intro_shown); | |
| const dontShowAgain = ref(false); | |
| function onClose() { | |
| if (dontShowAgain.value) { | |
| settings.saveSettings({ intro_shown: false }) | |
| const showDataProtectionNotice = ref(!settings.settings?.intro_shown); | |
| const dontShowAgain = ref(false); | |
| function onClose() { | |
| if (dontShowAgain.value) { | |
| settings.saveSettings({ intro_shown: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redrawCanvas()returns a Promise but ifcanvasRef/ctx/uploadedImageis missing, the functionreturns without callingresolve(), leaving callers (e.g.,cleanImageDataURL) awaiting a Promise that never settles. Resolve immediately in the early-exit path (or avoid wrapping in a Promise when prerequisites are missing).