Skip to content

Change multiple axes #555

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/components/World/AddNodeDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ class AddNodeDialog extends React.PureComponent<Props, State> {
this.setState(prevState => ({
node: {
...prevState.node,
startingOrigin: {
...prevState.node.startingOrigin,
...origin,
},
origin: {
...prevState.node.origin,
...origin,
Expand All @@ -114,7 +118,7 @@ class AddNodeDialog extends React.PureComponent<Props, State> {
geometry: undefined
});
};

private onGeometryChange_ = (id: string, geometry: Geometry) => {
if (id !== this.state.geometryId) return;

Expand Down Expand Up @@ -169,4 +173,4 @@ class AddNodeDialog extends React.PureComponent<Props, State> {

export default connect((state: ReduxState) => ({
locale: state.i18n.locale,
}))(AddNodeDialog) as React.ComponentType<AddNodeDialogPublicProps>;
}))(AddNodeDialog) as React.ComponentType<AddNodeDialogPublicProps>;
22 changes: 14 additions & 8 deletions src/components/World/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,14 @@ class World extends React.PureComponent<Props, State> {
const originalNode = Async.latestValue(this.props.scene).nodes[id];
this.props.onNodeChange(id, {
...originalNode,
startingOrigin: origin,
origin,
startingOrigin: {
...originalNode.startingOrigin,
...origin,
},
origin: {
...originalNode.origin,
...origin,
},
});
};

Expand All @@ -322,7 +328,7 @@ class World extends React.PureComponent<Props, State> {
const { scene } = props;

const originalNode = Async.latestValue(scene).nodes[id];

this.props.onNodeChange(id, {
...originalNode,
origin: {
Expand All @@ -342,7 +348,7 @@ class World extends React.PureComponent<Props, State> {
const idStr = id as string;

const workingScene = Async.latestValue(scene);

const node = workingScene.nodes[idStr];
if (node.type === 'object') {
if (node.geometryId !== undefined) {
Expand Down Expand Up @@ -474,12 +480,12 @@ class World extends React.PureComponent<Props, State> {
}
}));
}

return (
<>
<ScrollArea theme={theme} style={{ flex: '1 1' }}>
<Container theme={theme} style={style} className={className}>
<StyledListSection
<StyledListSection
name={itemsName}
theme={theme}
onCollapsedChange={this.onCollapsedChange_('items')}
Expand All @@ -492,7 +498,7 @@ class World extends React.PureComponent<Props, State> {
theme={theme}
/>
</StyledListSection>
<StyledListSection
<StyledListSection
name={scriptsName}
theme={theme}
onCollapsedChange={this.onCollapsedChange_('scripts')}
Expand Down Expand Up @@ -548,4 +554,4 @@ class World extends React.PureComponent<Props, State> {

export default connect((state: ReduxState) => ({
locale: state.i18n.locale,
}))(World) as React.ComponentType<WorldPublicProps>;
}))(World) as React.ComponentType<WorldPublicProps>;