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

updated the instance list icons #7207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
100 changes: 53 additions & 47 deletions newIDE/app/src/InstancesEditor/InstancesList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { toFixedWithoutTrailingZeros } from '../../Utils/Mathematics';
import ErrorBoundary from '../../UI/ErrorBoundary';
import useForceUpdate from '../../Utils/UseForceUpdate';
import { Column, Line } from '../../UI/Grid';
import LayersIcon from '../../UI/CustomSvgIcons/Layers';
import RotateZ from '../../UI/CustomSvgIcons/RotateZ';
const gd = global.gd;

const minimumWidths = {
Expand Down Expand Up @@ -149,36 +151,39 @@ class InstancesList extends Component<Props, State> {
}
};

_renderLockCell = ({
rowData: { instance },
}: {
rowData: RenderedRowInfo,
}) => {
return (
<IconButton
size="small"
onClick={() => {
if (instance.isSealed()) {
instance.setSealed(false);
instance.setLocked(false);
return;
}
if (instance.isLocked()) {
instance.setSealed(true);
return;
}
instance.setLocked(true);
}}
>
{instance.isLocked() && instance.isSealed() ? (
<RemoveCircle />
) : instance.isLocked() ? (
<Lock />
) : (
<LockOpen />
)}
</IconButton>
);
_renderLockCell = ({
rowData: { instance },
}: {
rowData: RenderedRowInfo,
}) => {
return (
<IconButton
size="small"
style={{
opacity: instance.isLocked() ? 1 : 0.4,
}}
onClick={() => {
if (instance.isSealed()) {
instance.setSealed(false);
instance.setLocked(false);
return;
}
if (instance.isLocked()) {
instance.setSealed(true);
return;
}
instance.setLocked(true);
}}
>
{instance.isLocked() && instance.isSealed() ? (
<RemoveCircle />
) : instance.isLocked() ? (
<Lock />
) : (
<LockOpen />
)}
</IconButton>
);
};

_selectFirstInstance = () => {
Expand Down Expand Up @@ -291,36 +296,36 @@ class InstancesList extends Component<Props, State> {
width={Math.max(width * 0.35, minimumWidths.objectName)}
className={'tableColumn'}
/>

<RVColumn
label=""
dataKey="locked"
label={<Trans>X</Trans>}
dataKey="x"
width={Math.max(
width * 0.05,
width * 0.1,
minimumWidths.numberProperty
)}
className={'tableColumn'}
cellRenderer={this._renderLockCell}
/>
<RVColumn
label={<Trans>X</Trans>}
dataKey="x"
label={<Trans>Y</Trans>}
dataKey="y"
width={Math.max(
width * 0.1,
minimumWidths.numberProperty
)}
className={'tableColumn'}
/>
<RVColumn
label={<Trans>Y</Trans>}
dataKey="y"
label={<Trans>Z Order</Trans>}
dataKey="zOrder"
width={Math.max(
width * 0.1,
minimumWidths.numberProperty
)}
className={'tableColumn'}
/>
<RVColumn
label={<Trans>Angle</Trans>}
<RVColumn
label={<Trans><RotateZ></RotateZ></Trans>}
dataKey="angle"
width={Math.max(
width * 0.1,
Expand All @@ -329,21 +334,22 @@ class InstancesList extends Component<Props, State> {
className={'tableColumn'}
/>
<RVColumn
label={<Trans>Layer</Trans>}
label={<Trans><LayersIcon></LayersIcon></Trans>}
dataKey="layer"
width={Math.max(width * 0.2, minimumWidths.layerName)}
width={Math.max(width * 0.1, minimumWidths.layerName)}
className={'tableColumn'}
/>
<RVColumn
label={<Trans>Z Order</Trans>}
dataKey="zOrder"
<RVColumn
label=""
dataKey="locked"
width={Math.max(
width * 0.1,
width * 0.05,
minimumWidths.numberProperty
)}
className={'tableColumn'}
cellRenderer={this._renderLockCell}
/>
</RVTable>
</RVTable>
)}
</AutoSizer>
</div>
Expand Down