Skip to content
Merged
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
11 changes: 9 additions & 2 deletions newIDE/app/src/CompactPropertiesEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export type ValueFieldCommonProperties = {|
getExtraDescription?: Instance => string,
hasImpactOnAllOtherFields?: boolean,
canBeUnlimitedUsingMinus1?: boolean,
disabled?: (instances: Array<gdInitialInstance>) => boolean,
disabled?: (instances: Array<Instance>) => boolean,
onEditButtonBuildMenuTemplate?: (i18n: I18nType) => Array<MenuItemTemplate>,
onEditButtonClick?: () => void,
getValueFromDisplayedValue?: string => string,
Expand Down Expand Up @@ -204,6 +204,7 @@ export type Field =
removeSpacers?: boolean,
title?: ?string,
children: Array<Field>,
isHidden?: (Array<Instance>) => boolean,
|};

// The schema is the tree of all fields.
Expand All @@ -217,6 +218,7 @@ type Props = {|
mode?: 'column' | 'row',
preventWrap?: boolean,
removeSpacers?: boolean,
isHidden?: (Array<Instance>) => boolean,

// If set, render the "extra" description content from fields
// (see getExtraDescription).
Expand Down Expand Up @@ -380,6 +382,7 @@ const CompactPropertiesEditor = ({
resourceManagementProps,
preventWrap,
removeSpacers,
isHidden,
}: Props) => {
const forceUpdate = useForceUpdate();

Expand Down Expand Up @@ -871,7 +874,9 @@ const CompactPropertiesEditor = ({
);

const renderContainer =
mode === 'row'
isHidden && isHidden(instances)
? (fields: React.Node) => null
: mode === 'row'
? (fields: React.Node) =>
preventWrap ? (
removeSpacers ? (
Expand Down Expand Up @@ -1018,6 +1023,7 @@ const CompactPropertiesEditor = ({
onRefreshAllFields={onRefreshAllFields}
preventWrap={field.preventWrap}
removeSpacers={field.removeSpacers}
isHidden={field.isHidden}
/>
) : (
<div key={field.name} style={styles.container}>
Expand All @@ -1032,6 +1038,7 @@ const CompactPropertiesEditor = ({
onRefreshAllFields={onRefreshAllFields}
preventWrap={field.preventWrap}
removeSpacers={field.removeSpacers}
isHidden={field.isHidden}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ export const reorderInstanceSchemaForCustomProperties = (
const contentSectionTitle: SectionTitle = {
nonFieldType: 'sectionTitle',
name: 'Content',
title: 'Content',
title: i18n._(t`Content`),
getValue: undefined,
};
if (animationFieldIndex === -1) {
Expand Down
4 changes: 2 additions & 2 deletions newIDE/app/src/InstancesEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export type InstancesEditorPropsWithoutSizeAndScroll = {|
layersContainer: gdLayersContainer,
globalObjectsContainer: gdObjectsContainer | null,
objectsContainer: gdObjectsContainer,
selectedLayer: string,
chosenLayer: string,
initialInstances: gdInitialInstancesContainer,
instancesEditorSettings: InstancesEditorSettings,
isInstanceOf3DObject: gdInitialInstance => boolean,
Expand Down Expand Up @@ -1686,7 +1686,7 @@ export default class InstancesEditor extends Component<Props, State> {
_instancesAdder.createOrUpdateTemporaryInstancesFromObjectNames(
pos,
this.props.selectedObjectNames,
this.props.selectedLayer
this.props.chosenLayer
);
}}
drop={monitor => {
Expand Down
50 changes: 0 additions & 50 deletions newIDE/app/src/LayersList/BackgroundColorRow.js

This file was deleted.

94 changes: 94 additions & 0 deletions newIDE/app/src/LayersList/BackgroundColorTreeViewItemContent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// @flow
import { type I18n as I18nType } from '@lingui/core';
import { t } from '@lingui/macro';

import * as React from 'react';
import { TreeViewItemContent } from '.';
import { type HTMLDataset } from '../Utils/HTMLDataset';
import ColorPicker from '../UI/ColorField/ColorPicker';

export const backgroundColorId = 'background-color';

export class BackgroundColorTreeViewItemContent implements TreeViewItemContent {
layout: gdLayout;
onBackgroundColorChanged: () => void;

constructor(layout: gdLayout, onBackgroundColorChanged: () => void) {
this.layout = layout;
this.onBackgroundColorChanged = onBackgroundColorChanged;
}

getName(i18n: I18nType): string | React.Node {
return i18n._(t`Background color`);
}

getId(): string {
return backgroundColorId;
}

getRightButton(i18n: I18nType) {
return [];
}

getHtmlId(index: number): ?string {
return backgroundColorId;
}

getDataSet(): ?HTMLDataset {
return null;
}

getThumbnail(): ?string {
return null;
}

onClick(): void {}

buildMenuTemplate(i18n: I18nType, index: number) {
return [];
}

renderRightComponent(i18n: I18nType): ?React.Node {
return (
<ColorPicker
disableAlpha
color={{
r: this.layout.getBackgroundColorRed(),
g: this.layout.getBackgroundColorGreen(),
b: this.layout.getBackgroundColorBlue(),
a: 255,
}}
onChangeComplete={color => {
this.layout.setBackgroundColor(color.rgb.r, color.rgb.g, color.rgb.b);
this.onBackgroundColorChanged();
}}
/>
);
}

rename(newName: string): void {}

edit(): void {}

delete(): void {}

copy(): void {}

paste(): void {}

cut(): void {}

getIndex(): number {
return 0;
}

moveAt(destinationIndex: number): void {}

isDescendantOf(itemContent: TreeViewItemContent): boolean {
return false;
}

getRootId(): string {
return '';
}
}
Loading