Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Add viewer tab on settings #1148

wants to merge 1 commit into from

Conversation

fsdavid
Copy link
Contributor

@fsdavid fsdavid commented Feb 1, 2022

No description provided.

Copy link
Member

@xgui3783 xgui3783 left a 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`
Copy link
Member

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?

src/ui/config/configCmp/config.component.ts Show resolved Hide resolved
constructor(
private store: Store<IavRootStoreInterface>,
private pureConstantService: PureContantService,
@Optional() @Inject(VIEWER_INJECTION_TOKEN) private injectedViewer,
Copy link
Member

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

Comment on lines +208 to +211
public get axisLineVisible() {
const panel: any = Array.from(this.viewer.display.panels)[0]
return panel?.viewer?.showAxisLines?.value
}
Copy link
Member

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.

Comment on lines +213 to +222
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
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above.

Comment on lines +225 to +239
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
}
Copy link
Member

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

Comment on lines +248 to +251
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
}
Copy link
Member

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$:

Comment on lines +269 to +275
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()
}
Copy link
Member

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)

Comment on lines +281 to +282
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))
Copy link
Member

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)

@fsdavid
Copy link
Contributor Author

fsdavid commented Feb 1, 2022

Moved here:
#1150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants