-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add viewer tab on settings #1148
Conversation
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.
In addition, can you merge from staging
so that the docker build can succeed?
|
||
const GPU_TOOLTIP = `Higher GPU usage can cause crashes on lower end machines` | ||
const ANIMATION_TOOLTIP = `Animation can cause slowdowns in lower end machines` | ||
const MOBILE_UI_TOOLTIP = `Mobile UI enables touch controls` | ||
const AXIS_LINE_TOOLTIP = `Show axis lines on the slice views` | ||
const BACKGROUND_COLORING_TOOLTIP = `Show ble background coloring on the perspective view` |
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.
Typo, blue, not ble.
Also, for constants like this, can we use constants.js and import here?
constructor( | ||
private store: Store<IavRootStoreInterface>, | ||
private pureConstantService: PureContantService, | ||
@Optional() @Inject(VIEWER_INJECTION_TOKEN) private injectedViewer, |
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.
there's no longer need for VIEWER_INJECTION_TOKEN
public get axisLineVisible() { | ||
const panel: any = Array.from(this.viewer.display.panels)[0] | ||
return panel?.viewer?.showAxisLines?.value | ||
} |
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.
There is an easier method
viewer.showAxisLines.value
and to set:
viewer.showAxisLines.restoreState(true || false)
What I am more concerned is this method called on every render cycle, which could make it a big liability.
public set axisLineVisible(value) { | ||
const panel: any = Array.from(this.viewer.display.panels)[0] | ||
if (panel && panel.viewer) { | ||
panel.viewer.showAxisLines.value = value | ||
} | ||
} | ||
|
||
public toggleAxisLines(value) { | ||
this.axisLineVisible = value | ||
} |
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.
see above.
public get showScaleBar() { | ||
const panel: any = Array.from(this.viewer.display.panels).find((p: any) => p.viewer?.orthographicProjection) | ||
return panel?.viewer?.showScaleBar?.value | ||
} | ||
|
||
public set showScaleBar(value) { | ||
const panel: any = Array.from(this.viewer.display.panels).find((p: any) => p.viewer?.orthographicProjection) | ||
if (panel && panel.viewer) { | ||
panel.viewer.showScaleBar.value = value | ||
} | ||
} | ||
|
||
public toggleScaleBar(value) { | ||
this.showScaleBar = value | ||
} |
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.
ditto above with viewer.showScaleBar
public get sliceBackground() { | ||
const panel: any = Array.from(this.viewer.display.panels).find((p: any) => p.viewer?.orthographicProjection) | ||
return panel?.config?.layout.useNehubaPerspective.drawSubstrates.color | ||
} |
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.
there is an easier way to get nehuba config
(window as any).nehubaViewer.config
That being said, we should probably do what we did with nehubaViewer, and inject it as an observable.
e.g. something like
@Optional() @Inject(NEHUBA_INSTANCE_INJTKN) nehubaViewer$:
public set showBackground(value) { | ||
const panel: any = Array.from(this.viewer.display.panels).find((p: any) => p.viewer?.orthographicProjection) | ||
if (panel && panel.config) { | ||
panel.config.layout.useNehubaPerspective.drawSubstrates.color[3] = value ? 0.2 : 0 | ||
} | ||
this.nehubaViewer.redraw() | ||
} |
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.
I think if we set the drawSubstrates
to falsy, and then call redraw, it would also work (probably more performant)
public hexToRgb = hex => hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(m, r, g, b) => '#' + r + r + g + g + b + b) | ||
.substring(1).match(/.{2}/g).map(x => parseInt(x, 16)) |
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.
do not use SO answer (at least directly). It's CC-SA license, and not compatible with our code.
There is a hextorgb code in repository (it's in worker, so unfortunately you can't import it, but you can copy paste it)
Moved here: |
No description provided.