From cf540963262de920ded4d8cc746b4c9704dee4f3 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Wed, 5 Jul 2023 16:27:21 +0800 Subject: [PATCH] Looks like GiftedDialog works? A little cleanup. --- src/components/GiftedDialog.vue | 11 +++--- src/libs/endorserServer.ts | 2 +- src/views/StatisticsView.vue | 66 ++------------------------------- 3 files changed, 10 insertions(+), 69 deletions(-) diff --git a/src/components/GiftedDialog.vue b/src/components/GiftedDialog.vue index d6c630c..018c1c5 100644 --- a/src/components/GiftedDialog.vue +++ b/src/components/GiftedDialog.vue @@ -41,7 +41,7 @@ diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts index 026e705..3000409 100644 --- a/src/libs/endorserServer.ts +++ b/src/libs/endorserServer.ts @@ -90,7 +90,7 @@ export function didInfo(did, identifiers, contacts) { if (contact) { return contact.name || "Someone Unnamed in Contacts"; } else if (!did) { - return "Unpecified Person"; + return "Unspecified Person"; } else if (isHiddenDid(did)) { return "Someone Not In Network"; } else { diff --git a/src/views/StatisticsView.vue b/src/views/StatisticsView.vue index 1b01fa9..b931f4f 100644 --- a/src/views/StatisticsView.vue +++ b/src/views/StatisticsView.vue @@ -103,6 +103,8 @@ interface WorldProperties { export default class StatisticsView extends Vue { world: World; worldProperties: WorldProperties = {}; + alertTitle = ""; + alertMessage = ""; // 'mounted' hook runs after initial render mounted() { @@ -114,68 +116,12 @@ export default class StatisticsView extends Vue { this.world = newWorld; } catch (err) { console.log(err); + this.alertTitle = "Mounting error"; + this.alertMessage = err.message; } } public captureGraphics() { - /** - // from https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#examples - // Adds a blank image - const dataBlob = document - .querySelector("#scene-container") - .firstChild.toBlob((blob) => { - const newImg = document.createElement("img"); - const url = URL.createObjectURL(blob); - - newImg.onload = () => { - // no longer need to read the blob so it's revoked - URL.revokeObjectURL(url); - }; - - newImg.src = url; - document.body.appendChild(newImg); - }); - **/ - - /** - // Yields a blank page with the iframe below - const dataUrl = document - .querySelector("#scene-container") - .firstChild.toDataURL("image/png"); - **/ - - /** - // Yields a blank page with the iframe below - const dataUrl = this.world.renderer.domElement.toDataURL("image/png"); - **/ - - /** - // Show the image in a new tab - const iframe = ` - `; - const win = window.open(); - win.document.open(); - win.document.write(iframe); - win.document.close(); - **/ - - // from https://stackoverflow.com/a/17407392/845494 - // This yields a file with funny formatting. - //const image = const dataUrl.replace("image/png", "image/octet-stream"); - - /** - // Yields a blank image at the bottom of the page - // from https://discourse.threejs.org/t/save-screenshot-on-server/39900/3 - const img = new Image(); - img.src = this.world.renderer.domElement.toDataURL(); - document.body.appendChild(img); - **/ - /** * This yields an SVG that only shows white and black highlights // from https://stackoverflow.com/questions/27632621/exporting-from-three-js-scene-to-svg-or-other-vector-format @@ -183,16 +129,12 @@ export default class StatisticsView extends Vue { const rendererSVG = new SVGRenderer(); rendererSVG.setSize(window.innerWidth, window.innerHeight); rendererSVG.render(this.world.scene, this.world.camera); - //document.body.appendChild(rendererSVG.domElement); ExportToSVG(rendererSVG, "test.svg"); } public setWorldProperty(propertyName, propertyValue) { this.worldProperties[propertyName] = propertyValue; } - - alertTitle = ""; - alertMessage = ""; } function ExportToSVG(rendererSVG, filename) {