-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow saving/loading of landmark pairs
feat: indicate hovered landmark feat: drag/drop landmarks feat: allow deletion of landmark pairs feat: show fallback msg when no landmarks has been added feat: on click landmark in list view, navigates there feat: show z displacement, use different anchor feat: add voxel size adjustments parallel to scale adjustment feat: add flip axis bugfix: allow the tools buttons to toggle the dialog WIP: share export component feat: split view mode feat: pretty print navigation array bugfix: floatarrayeql compare length first bugfix: copy paste no longer copies viewer state
- Loading branch information
Showing
51 changed files
with
1,926 additions
and
454 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Directive, EventEmitter, HostListener, Input, Output } from "@angular/core"; | ||
|
||
@Directive({ | ||
selector: '[voluba-load-from-file]', | ||
exportAs: 'volubaLoadFromFile', | ||
}) | ||
|
||
export class LoadFromFileDirective { | ||
@Input('from-file-extensions') | ||
extensionsToLoad: string = '.json' | ||
|
||
@Output('from-file-content') | ||
emitContent = new EventEmitter<string>() | ||
|
||
@HostListener('click') | ||
load(){ | ||
const input = document.createElement("input") | ||
input.type = 'file' | ||
input.accept = this.extensionsToLoad | ||
document.body.appendChild(input) | ||
input.onchange = () => { | ||
if (input.files?.length !== 1) { | ||
throw new Error(`Expected one and only one file selected, but got ${input.files?.length}`) | ||
} | ||
const file = input.files[0] | ||
const reader = new FileReader() | ||
reader.onload = () => { | ||
const out = reader.result | ||
if (!out) throw new Error(`Could not get any content!`) | ||
this.emitContent.emit(out as string) | ||
} | ||
reader.onerror = e => { throw e } | ||
reader.readAsText(file, 'utf-8') | ||
|
||
document.body.removeChild(input) | ||
} | ||
input.click() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { NgModule } from "@angular/core"; | ||
import { SaveToFileDirective } from "./saveFile.directive"; | ||
import { LoadFromFileDirective } from "./loadFile.directive"; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
SaveToFileDirective, | ||
LoadFromFileDirective, | ||
], | ||
exports: [ | ||
SaveToFileDirective, | ||
LoadFromFileDirective, | ||
] | ||
}) | ||
|
||
export class IOModule{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Directive, HostListener, Input } from "@angular/core"; | ||
|
||
const textEncoder = new TextEncoder() | ||
|
||
@Directive({ | ||
selector: '[voluba-save-to-file]', | ||
exportAs: 'volubaSaveToFile' | ||
}) | ||
|
||
export class SaveToFileDirective{ | ||
@Input('to-file-content') | ||
textToSave: string|undefined | ||
|
||
@Input('to-file-filename') | ||
filename: string = 'savedFile.json' | ||
|
||
@Input('to-file-mimetype') | ||
mimetype: string = 'application/json' | ||
|
||
@HostListener('click') | ||
onClick(){ | ||
const { mimetype, filename, textToSave } = this | ||
const blob = new Blob([ textEncoder.encode(textToSave) || ''], {type: mimetype}) | ||
const _url = URL.createObjectURL(blob) | ||
|
||
const link = document.createElement('a') | ||
link.setAttribute('href', _url) | ||
link.setAttribute('download', filename) | ||
link.style.visibility = 'hidden' | ||
|
||
document.body.appendChild(link) | ||
link.click() | ||
document.body.removeChild(link) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.