Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
hbcarlos committed Jan 13, 2023
1 parent 2726f3e commit 96fff01
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/mainview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ export class MainView extends React.Component<IProps, IStates> {
sender: ObservableMap<JSONValue>,
change: IObservableMap.IChangedArgs<JSONValue>
): void {
if (change.key === 'axe') {
if (change.key === 'axes') {
this._sceneAxe?.removeFromParent();
const axe = change.newValue as AxeHelper | undefined;

Expand Down
18 changes: 9 additions & 9 deletions src/toolbar/helpertoolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface IProps {
}

interface IState {
Axe: IDict;
Axes: IDict;
}

const FORM_SCHEMA = {
Expand All @@ -22,7 +22,7 @@ const FORM_SCHEMA = {
properties: {
Size: {
type: 'number',
description: "Size of the axes"
description: 'Size of the axes'
},
Visible: {
type: 'boolean',
Expand Down Expand Up @@ -53,10 +53,10 @@ export class HelpersToolbarReact extends React.Component<IProps, IState> {
size: 5,
visible: false
};
this._panel.setView('axe', axe);
this._panel.setAxes(axe);

return {
Axe: {
Axes: {
title: 'Axes Helper',
shape: 'Axe::Helper',
schema: FORM_SCHEMA,
Expand All @@ -70,21 +70,21 @@ export class HelpersToolbarReact extends React.Component<IProps, IState> {
size: Size,
visible: Visible
};
this._panel.setView('axe', axe);
this._panel.setAxes(axe);
}
}
};
}

private _updateSchema(): void {
const axe = this._panel.getView('axe') as AxeHelper | undefined;
const { Axe } = this.state;
Axe['default'] = {
const axe = this._panel.getAxes();
const { Axes } = this.state;
Axes['default'] = {
Size: axe?.size ?? 5,
Visible: axe?.visible ?? true
};

this.setState({ Axe });
this.setState({ Axes });
}

render(): React.ReactNode {
Expand Down
6 changes: 3 additions & 3 deletions src/toolbar/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface IProps {
}

interface IState {
selected: 'PART' | 'OPERATOR' | 'HELPERS';
selected: 'PART' | 'OPERATOR' | 'DISPLAY';
}
export class ToolbarReact extends React.Component<IProps, IState> {
constructor(props: IProps) {
Expand Down Expand Up @@ -109,7 +109,7 @@ export class ToolbarReact extends React.Component<IProps, IState> {
{this.state.selected === 'OPERATOR' && (
<OperatorToolbarReact toolbarModel={this.props.toolbarModel} />
)}
{this.state.selected === 'HELPERS' && (
{this.state.selected === 'DISPLAY' && (
<HelpersToolbarReact toolbarModel={this.props.toolbarModel} />
)}
<UserToolbarReact toolbarModel={this.props.toolbarModel} />
Expand All @@ -118,5 +118,5 @@ export class ToolbarReact extends React.Component<IProps, IState> {
}

private _lastForm?: { dialog: FormDialog; title: string };
private _toolbarOption = ['PART', 'OPERATOR', 'HELPERS'];
private _toolbarOption = ['PART', 'OPERATOR', 'DISPLAY'];
}
14 changes: 7 additions & 7 deletions src/widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ISignal, Signal } from '@lumino/signaling';

import { MainView } from './mainview';
import { JupyterCadModel } from './model';
import { IJupyterCadWidget } from './types';
import { AxeHelper, IJupyterCadWidget } from './types';
import { JSONValue } from '@lumino/coreutils';

export class JupyterCadWidget
Expand Down Expand Up @@ -66,16 +66,16 @@ export class JupyterCadPanel extends ReactWidget {
super.dispose();
}

getView(key: string): JSONValue | undefined {
return this._view.get(key);
getAxes(): AxeHelper | undefined {
return this._view.get('axes') as AxeHelper;
}

setView(key: string, value: JSONValue): void {
this._view.set(key, value);
setAxes(value: AxeHelper): void {
this._view.set('axes', value);
}

deleteView(key: string): void {
this._view.delete(key);
deleteAxes(): void {
this._view.delete('axes');
}

render(): JSX.Element {
Expand Down

0 comments on commit 96fff01

Please sign in to comment.