mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Run prettier on newIDE codebase
This commit is contained in:
@@ -65,7 +65,12 @@ export default class NewBehaviorDialog extends Component {
|
||||
if (!open || !project) return null;
|
||||
|
||||
const actions = [
|
||||
<FlatButton key="close" label="Close" primary={false} onClick={onClose} />,
|
||||
<FlatButton
|
||||
key="close"
|
||||
label="Close"
|
||||
primary={false}
|
||||
onClick={onClose}
|
||||
/>,
|
||||
];
|
||||
|
||||
return (
|
||||
|
@@ -15,19 +15,21 @@ export const createTree = (
|
||||
allExpressions: Array<InstructionOrExpressionInformation>
|
||||
): InstructionOrExpressionTreeNode => {
|
||||
const tree = {};
|
||||
allExpressions.forEach((expressionInfo: InstructionOrExpressionInformation) => {
|
||||
update(
|
||||
tree,
|
||||
compact(expressionInfo.fullGroupName.split(GROUP_DELIMITER)),
|
||||
groupInfo => {
|
||||
const existingGroupInfo = groupInfo || {};
|
||||
return {
|
||||
...existingGroupInfo,
|
||||
[expressionInfo.displayedName]: expressionInfo,
|
||||
};
|
||||
}
|
||||
);
|
||||
});
|
||||
allExpressions.forEach(
|
||||
(expressionInfo: InstructionOrExpressionInformation) => {
|
||||
update(
|
||||
tree,
|
||||
compact(expressionInfo.fullGroupName.split(GROUP_DELIMITER)),
|
||||
groupInfo => {
|
||||
const existingGroupInfo = groupInfo || {};
|
||||
return {
|
||||
...existingGroupInfo,
|
||||
[expressionInfo.displayedName]: expressionInfo,
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
return tree;
|
||||
};
|
||||
|
@@ -50,7 +50,7 @@ const enumerateExtensionExpressions = (
|
||||
return allExpressions;
|
||||
};
|
||||
|
||||
export const enumerateExpressions = (type) => {
|
||||
export const enumerateExpressions = type => {
|
||||
const freeExpressions = [];
|
||||
const objectsExpressions = [];
|
||||
const behaviorsExpressions = [];
|
||||
@@ -85,7 +85,10 @@ export const enumerateExpressions = (type) => {
|
||||
//Free expressions
|
||||
freeExpressions.push.apply(
|
||||
freeExpressions,
|
||||
enumerateExtensionExpressions(prefix, allFreeExpressionsGetter.call(extension))
|
||||
enumerateExtensionExpressions(
|
||||
prefix,
|
||||
allFreeExpressionsGetter.call(extension)
|
||||
)
|
||||
);
|
||||
|
||||
//Objects expressions:
|
||||
@@ -134,14 +137,13 @@ export const enumerateExpressions = (type) => {
|
||||
};
|
||||
|
||||
export const filterExpressions = (list, searchText) => {
|
||||
if (!searchText) return list;
|
||||
const lowercaseSearchText = searchText.toLowerCase();
|
||||
if (!searchText) return list;
|
||||
const lowercaseSearchText = searchText.toLowerCase();
|
||||
|
||||
return list.filter(enumeratedExpression => {
|
||||
return (
|
||||
enumeratedExpression.type
|
||||
.toLowerCase()
|
||||
.indexOf(lowercaseSearchText) !== -1
|
||||
);
|
||||
});
|
||||
}
|
||||
return list.filter(enumeratedExpression => {
|
||||
return (
|
||||
enumeratedExpression.type.toLowerCase().indexOf(lowercaseSearchText) !==
|
||||
-1
|
||||
);
|
||||
});
|
||||
};
|
||||
|
@@ -15,5 +15,5 @@ describe('EnumerateInstructions', () => {
|
||||
it('can create the tree of instructions', () => {
|
||||
const instructions = enumerateInstructions('number');
|
||||
expect(createTree(instructions)).toMatchSnapshot();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
@@ -121,9 +121,7 @@ export class InstructionOrExpressionSelector extends Component {
|
||||
style={styles.searchBar}
|
||||
ref={searchBar => (this._searchBar = searchBar)}
|
||||
/>
|
||||
<SelectableList
|
||||
value={this.props.selectedType}
|
||||
>
|
||||
<SelectableList value={this.props.selectedType}>
|
||||
{this.state.search
|
||||
? this._renderSearchResults()
|
||||
: this._renderTree(this.props.instructionsInfoTree)}
|
||||
|
@@ -37,7 +37,12 @@ export default class ExpressionParametersEditorDialog extends Component<
|
||||
}
|
||||
|
||||
render() {
|
||||
const { project, layout, expressionMetadata, parameterRenderingService } = this.props;
|
||||
const {
|
||||
project,
|
||||
layout,
|
||||
expressionMetadata,
|
||||
parameterRenderingService,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
|
@@ -25,10 +25,13 @@ describe('HelpButton', () => {
|
||||
});
|
||||
|
||||
it('properly format a free function, with "code-only" parameters', () => {
|
||||
const cameraHeightExpression = filterExpressions(freeExpressions, 'CameraHeight')[0];
|
||||
expect(formatExpressionCall(cameraHeightExpression, ['', '"My layer"', "0"])).toBe(
|
||||
'CameraHeight("My layer", 0)'
|
||||
);
|
||||
const cameraHeightExpression = filterExpressions(
|
||||
freeExpressions,
|
||||
'CameraHeight'
|
||||
)[0];
|
||||
expect(
|
||||
formatExpressionCall(cameraHeightExpression, ['', '"My layer"', '0'])
|
||||
).toBe('CameraHeight("My layer", 0)');
|
||||
});
|
||||
|
||||
it('properly format an object function', () => {
|
||||
|
@@ -39,12 +39,15 @@ export default class LinkEvent extends Component {
|
||||
}
|
||||
|
||||
edit = domEvent => {
|
||||
this.setState({
|
||||
editing: true,
|
||||
anchorEl: domEvent.currentTarget,
|
||||
}, () => {
|
||||
if (this._externalEventsField) this._externalEventsField.focus();
|
||||
});
|
||||
this.setState(
|
||||
{
|
||||
editing: true,
|
||||
anchorEl: domEvent.currentTarget,
|
||||
},
|
||||
() => {
|
||||
if (this._externalEventsField) this._externalEventsField.focus();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
endEditing = () => {
|
||||
@@ -90,7 +93,8 @@ export default class LinkEvent extends Component {
|
||||
this.props.onUpdate();
|
||||
}}
|
||||
isInline
|
||||
ref={externalEventsField => this._externalEventsField = externalEventsField}
|
||||
ref={externalEventsField =>
|
||||
(this._externalEventsField = externalEventsField)}
|
||||
/>
|
||||
</InlinePopover>
|
||||
</div>
|
||||
|
@@ -190,17 +190,20 @@ export default class EventsSheet extends Component {
|
||||
this.state.editedInstruction.instruction.delete();
|
||||
}
|
||||
|
||||
this.setState({
|
||||
editedInstruction: {
|
||||
isCondition: true,
|
||||
instruction: null,
|
||||
instrsList: null,
|
||||
this.setState(
|
||||
{
|
||||
editedInstruction: {
|
||||
isCondition: true,
|
||||
instruction: null,
|
||||
instrsList: null,
|
||||
},
|
||||
},
|
||||
}, () => {
|
||||
if (saveChanges) {
|
||||
this._saveChangesToHistory();
|
||||
() => {
|
||||
if (saveChanges) {
|
||||
this._saveChangesToHistory();
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
selectEvent = eventContext => {
|
||||
|
@@ -73,7 +73,10 @@ export default class BrowserS3PreviewLauncher {
|
||||
});
|
||||
};
|
||||
|
||||
static launchLayoutPreview = (project: gdProject, layout: gdLayout): Promise<any> => {
|
||||
static launchLayoutPreview = (
|
||||
project: gdProject,
|
||||
layout: gdLayout
|
||||
): Promise<any> => {
|
||||
if (!project || !layout) return Promise.reject();
|
||||
|
||||
return BrowserS3PreviewLauncher._prepareExporter().then(
|
||||
|
@@ -47,7 +47,10 @@ export default class LocalPreviewLauncher {
|
||||
});
|
||||
};
|
||||
|
||||
static launchLayoutPreview = (project: gdProject, layout: gdLayout): Promise<any> => {
|
||||
static launchLayoutPreview = (
|
||||
project: gdProject,
|
||||
layout: gdLayout
|
||||
): Promise<any> => {
|
||||
if (!project || !layout) return Promise.reject();
|
||||
|
||||
return LocalPreviewLauncher._prepareExporter().then(
|
||||
|
@@ -99,7 +99,13 @@ export const addScrollbars = (WrappedComponent: any) => {
|
||||
);
|
||||
};
|
||||
|
||||
_setAndAdjust = ({ xValue, yValue }: {xValue: number, yValue: number}) => {
|
||||
_setAndAdjust = ({
|
||||
xValue,
|
||||
yValue,
|
||||
}: {
|
||||
xValue: number,
|
||||
yValue: number,
|
||||
}) => {
|
||||
const xMax = Math.max(Math.abs(xValue) + 100, this.state.xMax);
|
||||
const yMax = Math.max(Math.abs(yValue) + 100, this.state.yMax);
|
||||
|
||||
|
@@ -87,7 +87,12 @@ export default class InstancesEditorContainer extends Component {
|
||||
this._onMouseMove(event.data.global.x, event.data.global.y)
|
||||
);
|
||||
this.backgroundArea.on('panmove', event =>
|
||||
this._onPanMove(event.deltaX, event.deltaY, event.data.global.x, event.data.global.y)
|
||||
this._onPanMove(
|
||||
event.deltaX,
|
||||
event.deltaY,
|
||||
event.data.global.x,
|
||||
event.data.global.y
|
||||
)
|
||||
);
|
||||
this.backgroundArea.on('panend', event => this._onEndSelectionRectangle());
|
||||
this.pixiContainer.addChild(this.backgroundArea);
|
||||
@@ -460,7 +465,7 @@ export default class InstancesEditorContainer extends Component {
|
||||
|
||||
getViewPosition = () => {
|
||||
return this.viewPosition;
|
||||
}
|
||||
};
|
||||
|
||||
_renderScene = () => {
|
||||
// Protect against rendering scheduled after the component is unmounted.
|
||||
|
@@ -34,10 +34,7 @@ export default class ConfirmCloseDialog extends Component {
|
||||
|
||||
render() {
|
||||
const actions = [
|
||||
<FlatButton
|
||||
label="Cancel"
|
||||
onTouchTap={this.handleCancel}
|
||||
/>,
|
||||
<FlatButton label="Cancel" onTouchTap={this.handleCancel} />,
|
||||
<FlatButton
|
||||
label="Close project"
|
||||
primary={true}
|
||||
|
@@ -31,7 +31,7 @@ export const openEditorTab = (
|
||||
editorRef: null,
|
||||
name,
|
||||
key,
|
||||
closable: typeof closable === "undefined" ? true : !!closable,
|
||||
closable: typeof closable === 'undefined' ? true : !!closable,
|
||||
};
|
||||
|
||||
return {
|
||||
|
@@ -66,7 +66,14 @@ export default class StartPage extends BaseEditor {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { project, canOpen, onOpen, onCreate, onOpenProjectManager, onCloseProject } = this.props;
|
||||
const {
|
||||
project,
|
||||
canOpen,
|
||||
onOpen,
|
||||
onCreate,
|
||||
onOpenProjectManager,
|
||||
onCloseProject,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<div style={styles.scrollContainer}>
|
||||
@@ -81,28 +88,35 @@ export default class StartPage extends BaseEditor {
|
||||
</p>
|
||||
</Paper>
|
||||
<Paper zDepth={1} style={styles.buttonsPaper}>
|
||||
{!project && canOpen && (
|
||||
{!project &&
|
||||
canOpen && (
|
||||
<FlatButton
|
||||
label="Open a project"
|
||||
fullWidth
|
||||
onClick={onOpen}
|
||||
/>
|
||||
)}
|
||||
{!project && (
|
||||
<FlatButton
|
||||
label="Open a project"
|
||||
label="Create a new project"
|
||||
fullWidth
|
||||
onClick={onOpen}
|
||||
onClick={onCreate}
|
||||
/>
|
||||
)}
|
||||
{!!project && (
|
||||
<FlatButton
|
||||
label="Open Project Manager"
|
||||
fullWidth
|
||||
onClick={onOpenProjectManager}
|
||||
/>
|
||||
)}
|
||||
{!!project && (
|
||||
<FlatButton
|
||||
label="Close project"
|
||||
fullWidth
|
||||
onClick={onCloseProject}
|
||||
/>
|
||||
)}
|
||||
{!project && (<FlatButton
|
||||
label="Create a new project"
|
||||
fullWidth
|
||||
onClick={onCreate}
|
||||
/>)}
|
||||
{!!project && (<FlatButton
|
||||
label="Open Project Manager"
|
||||
fullWidth
|
||||
onClick={onOpenProjectManager}
|
||||
/>)}
|
||||
{!!project && (<FlatButton
|
||||
label="Close project"
|
||||
fullWidth
|
||||
onClick={onCloseProject}
|
||||
/>)}
|
||||
</Paper>
|
||||
</div>
|
||||
</Line>
|
||||
|
@@ -174,13 +174,13 @@ export default class PointsEditor extends Component {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ImagePreview
|
||||
resourceName={hasValidSprite ? sprite.getImageName() : ''}
|
||||
resourcesLoader={resourcesLoader}
|
||||
project={project}
|
||||
>
|
||||
{hasValidSprite && <PointsPreview pointsContainer={sprite} />}
|
||||
</ImagePreview>
|
||||
<ImagePreview
|
||||
resourceName={hasValidSprite ? sprite.getImageName() : ''}
|
||||
resourcesLoader={resourcesLoader}
|
||||
project={project}
|
||||
>
|
||||
{hasValidSprite && <PointsPreview pointsContainer={sprite} />}
|
||||
</ImagePreview>
|
||||
<Line>
|
||||
<Column expand>
|
||||
<Toggle
|
||||
@@ -237,7 +237,11 @@ export default class PointsEditor extends Component {
|
||||
>
|
||||
{mapFor(0, direction.getSpritesCount(), i => {
|
||||
return (
|
||||
<MenuItem value={i} key={i} primaryText={`Frame #${i}`} />
|
||||
<MenuItem
|
||||
value={i}
|
||||
key={i}
|
||||
primaryText={`Frame #${i}`}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</SelectField>
|
||||
@@ -247,7 +251,8 @@ export default class PointsEditor extends Component {
|
||||
label="Share same points for all sprites of the animation"
|
||||
labelPosition="right"
|
||||
toggled={samePointsForSprites}
|
||||
onToggle={(e, checked) => this._onToggleSamePointsForSprites(checked)}
|
||||
onToggle={(e, checked) =>
|
||||
this._onToggleSamePointsForSprites(checked)}
|
||||
/>
|
||||
</Column>
|
||||
</Line>
|
||||
|
@@ -1,17 +1,17 @@
|
||||
//TODO: Factor with styles.js from LayersList.
|
||||
export default {
|
||||
handleColumn: {
|
||||
width: 24,
|
||||
paddingLeft: 8,
|
||||
paddingRight: 0,
|
||||
},
|
||||
coordinateColumn: {
|
||||
width: 48,
|
||||
},
|
||||
toolColumn: {
|
||||
width: 48,
|
||||
},
|
||||
pointRow: {
|
||||
backgroundColor: 'white',
|
||||
}
|
||||
};
|
||||
handleColumn: {
|
||||
width: 24,
|
||||
paddingLeft: 8,
|
||||
paddingRight: 0,
|
||||
},
|
||||
coordinateColumn: {
|
||||
width: 48,
|
||||
},
|
||||
toolColumn: {
|
||||
width: 48,
|
||||
},
|
||||
pointRow: {
|
||||
backgroundColor: 'white',
|
||||
},
|
||||
};
|
||||
|
@@ -31,7 +31,11 @@ export class ObjectEditorDialog extends Component<*, StateType> {
|
||||
|
||||
render() {
|
||||
const actions = [
|
||||
<FlatButton key="cancel" label="Cancel" onTouchTap={this.props.onCancel} />,
|
||||
<FlatButton
|
||||
key="cancel"
|
||||
label="Cancel"
|
||||
onTouchTap={this.props.onCancel}
|
||||
/>,
|
||||
<FlatButton
|
||||
key="apply"
|
||||
label="Apply"
|
||||
|
@@ -19,13 +19,13 @@ export default {
|
||||
component: SpriteEditor,
|
||||
newObjectCreator: () => new gd.SpriteObject(''),
|
||||
castToObjectType: object => gd.asSpriteObject(object),
|
||||
helpPagePath: "/objects/sprite",
|
||||
helpPagePath: '/objects/sprite',
|
||||
},
|
||||
'TiledSpriteObject::TiledSprite': {
|
||||
component: TiledSpriteEditor,
|
||||
newObjectCreator: () => new gd.TiledSpriteObject(''),
|
||||
castToObjectType: object => gd.asTiledSpriteObject(object),
|
||||
helpPagePath: "/objects/tiled_sprite",
|
||||
helpPagePath: '/objects/tiled_sprite',
|
||||
},
|
||||
'PanelSpriteObject::PanelSprite': {
|
||||
component: PanelSpriteEditor,
|
||||
@@ -41,19 +41,19 @@ export default {
|
||||
component: TextEditor,
|
||||
newObjectCreator: () => new gd.TextObject(''),
|
||||
castToObjectType: object => gd.asTextObject(object),
|
||||
helpPagePath: "/objects/text",
|
||||
helpPagePath: '/objects/text',
|
||||
},
|
||||
'PrimitiveDrawing::Drawer': {
|
||||
component: ShapePainterEditor,
|
||||
newObjectCreator: () => new gd.ShapePainterObject(''),
|
||||
castToObjectType: object => gd.asShapePainterObject(object),
|
||||
helpPagePath: "/objects/shape_painter",
|
||||
helpPagePath: '/objects/shape_painter',
|
||||
},
|
||||
'TextEntryObject::TextEntry': {
|
||||
component: EmptyEditor,
|
||||
newObjectCreator: () => new gd.TextEntryObject(''),
|
||||
castToObjectType: object => gd.asTextEntryObject(object),
|
||||
helpPagePath: "/objects/text_entry",
|
||||
helpPagePath: '/objects/text_entry',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@@ -45,7 +45,6 @@ export class ObjectsGroupEditorDialog extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default withSerializableObject(ObjectsGroupEditorDialog, {
|
||||
newObjectCreator: () => new gd.ObjectGroup(),
|
||||
propName: 'group',
|
||||
|
@@ -24,8 +24,14 @@ describe('EnumerateObjects', () => {
|
||||
allObjectsList,
|
||||
} = enumerateObjects(project, testLayout);
|
||||
|
||||
expect(filterObjectsList(containerObjectsList, "myshapepainterobject")).toHaveLength(1);
|
||||
expect(filterObjectsList(projectObjectsList, "myshapepainterobject")).toHaveLength(0);
|
||||
expect(filterObjectsList(allObjectsList, "myshapepainterobject")).toHaveLength(1);
|
||||
expect(
|
||||
filterObjectsList(containerObjectsList, 'myshapepainterobject')
|
||||
).toHaveLength(1);
|
||||
expect(
|
||||
filterObjectsList(projectObjectsList, 'myshapepainterobject')
|
||||
).toHaveLength(0);
|
||||
expect(
|
||||
filterObjectsList(allObjectsList, 'myshapepainterobject')
|
||||
).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
@@ -11,7 +11,7 @@ const styles = {
|
||||
explanations: {
|
||||
textAlign: 'center',
|
||||
margin: 20,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const publicImageUrls = [
|
||||
@@ -76,11 +76,8 @@ const publicImageUrls = [
|
||||
|
||||
const nameFromUrl = (url: string): string => {
|
||||
const urlParts = url.split('/');
|
||||
return urlParts[urlParts.length - 1].replace(
|
||||
'.png',
|
||||
''
|
||||
);
|
||||
}
|
||||
return urlParts[urlParts.length - 1].replace('.png', '');
|
||||
};
|
||||
|
||||
export default [
|
||||
{
|
||||
@@ -108,7 +105,7 @@ export default [
|
||||
leftAvatar={<ListIcon src={url} />}
|
||||
/>
|
||||
);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
chooseResources = (
|
||||
@@ -178,7 +175,10 @@ export default [
|
||||
autoScrollBodyContent
|
||||
>
|
||||
<div style={styles.explanations}>
|
||||
<p>Adding images from Dropbox, Google Drive... is coming soon! Download GDevelop desktop version to use your own assets.</p>
|
||||
<p>
|
||||
Adding images from Dropbox, Google Drive... is coming soon!
|
||||
Download GDevelop desktop version to use your own assets.
|
||||
</p>
|
||||
</div>
|
||||
<SelectableList
|
||||
value={this.state.chosenImageUrl}
|
||||
|
@@ -27,7 +27,9 @@ export default class ResourceSelector extends Component {
|
||||
.filter(source => source.kind === this.props.resourceKind)
|
||||
.map(source => ({
|
||||
text: '',
|
||||
value: <MenuItem primaryText={source.displayName} rightIcon={<Add />} />,
|
||||
value: (
|
||||
<MenuItem primaryText={source.displayName} rightIcon={<Add />} />
|
||||
),
|
||||
onClick: () => this._addFrom(source),
|
||||
})),
|
||||
{
|
||||
|
@@ -476,10 +476,16 @@ export default class InstancesFullEditor extends Component {
|
||||
|
||||
forceUpdatePropertiesEditor = () => {
|
||||
if (this._propertiesEditor) this._propertiesEditor.forceUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { project, layout, initialInstances, resourceSources, onChooseResource } = this.props;
|
||||
const {
|
||||
project,
|
||||
layout,
|
||||
initialInstances,
|
||||
resourceSources,
|
||||
onChooseResource,
|
||||
} = this.props;
|
||||
const selectedInstances = this.instancesSelection.getSelectedInstances();
|
||||
|
||||
const editors = {
|
||||
@@ -491,7 +497,8 @@ export default class InstancesFullEditor extends Component {
|
||||
instances={selectedInstances}
|
||||
onInstancesModified={this._onInstancesModified}
|
||||
editInstanceVariables={this.editInstanceVariables}
|
||||
ref={propertiesEditor => (this._propertiesEditor = propertiesEditor)}
|
||||
ref={propertiesEditor =>
|
||||
(this._propertiesEditor = propertiesEditor)}
|
||||
/>
|
||||
</MosaicWindow>
|
||||
),
|
||||
|
@@ -71,7 +71,8 @@ class EditorMosaic extends Component {
|
||||
render() {
|
||||
return (
|
||||
<MosaicWithoutDragDropContext
|
||||
renderTile={(editorName, path) => React.cloneElement(this.props.editors[editorName], { path })}
|
||||
renderTile={(editorName, path) =>
|
||||
React.cloneElement(this.props.editors[editorName], { path })}
|
||||
className="mosaic-blueprint-theme mosaic-gd-theme"
|
||||
value={this.state.mosaicNode}
|
||||
onChange={this._onChange}
|
||||
|
@@ -16,9 +16,7 @@ export default (props: PropsType) => {
|
||||
if (!helpPagePath) return null;
|
||||
|
||||
return (
|
||||
<IconButton
|
||||
onClick={() => window.open(getHelpLink(helpPagePath), 'blank') }
|
||||
>
|
||||
<IconButton onClick={() => window.open(getHelpLink(helpPagePath), 'blank')}>
|
||||
<HelpOutline />
|
||||
</IconButton>
|
||||
);
|
||||
|
@@ -21,7 +21,7 @@ const styles = {
|
||||
},
|
||||
};
|
||||
|
||||
export default class LocalFolderPicker extends Component<*,*> {
|
||||
export default class LocalFolderPicker extends Component<*, *> {
|
||||
onChooseFolder = () => {
|
||||
if (!dialog || !electron) return;
|
||||
|
||||
|
@@ -15,13 +15,7 @@ export default class ToolbarIcon extends Component {
|
||||
filter: this.props.disabled ? 'grayscale(100%)' : undefined,
|
||||
}}
|
||||
>
|
||||
<img
|
||||
title={tooltip}
|
||||
alt={tooltip}
|
||||
src={src}
|
||||
width={32}
|
||||
height={32}
|
||||
/>
|
||||
<img title={tooltip} alt={tooltip} src={src} width={32} height={32} />
|
||||
</IconButton>
|
||||
);
|
||||
}
|
||||
|
@@ -7,5 +7,5 @@ import AutoComplete from 'material-ui/AutoComplete';
|
||||
* @param {*} key
|
||||
*/
|
||||
export const fuzzyOrEmptyFilter = (searchText, key) => {
|
||||
return !key || AutoComplete.fuzzyFilter(searchText, key);
|
||||
return !key || AutoComplete.fuzzyFilter(searchText, key);
|
||||
};
|
||||
|
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
serializeToJSObject,
|
||||
unserializeFromJSObject,
|
||||
} from './Serializer';
|
||||
import { serializeToJSObject, unserializeFromJSObject } from './Serializer';
|
||||
|
||||
// Tools function to keep track of the history of changes made
|
||||
// on a serializable object from libGD.js
|
||||
@@ -63,7 +60,12 @@ export const undo = (history, serializableObject, project = undefined) => {
|
||||
}
|
||||
|
||||
const newCurrent = history.undoHistory[history.undoHistory.length - 1];
|
||||
unserializeFromJSObject(serializableObject, newCurrent, 'unserializeFrom', project);
|
||||
unserializeFromJSObject(
|
||||
serializableObject,
|
||||
newCurrent,
|
||||
'unserializeFrom',
|
||||
project
|
||||
);
|
||||
|
||||
return {
|
||||
undoHistory: history.undoHistory.slice(0, -1),
|
||||
@@ -86,7 +88,12 @@ export const redo = (history, serializableObject, project = undefined) => {
|
||||
}
|
||||
|
||||
const newCurrent = history.redoHistory[history.redoHistory.length - 1];
|
||||
unserializeFromJSObject(serializableObject, newCurrent, 'unserializeFrom', project);
|
||||
unserializeFromJSObject(
|
||||
serializableObject,
|
||||
newCurrent,
|
||||
'unserializeFrom',
|
||||
project
|
||||
);
|
||||
|
||||
return {
|
||||
undoHistory: [...history.undoHistory, history.current],
|
||||
|
@@ -31,17 +31,11 @@ export const makeTestProject = gd => {
|
||||
project.getResourcesManager().addResource(audioResource1);
|
||||
|
||||
// Create and expose some objects
|
||||
const shapePainterObject = new gd.ShapePainterObject(
|
||||
'MyShapePainterObject'
|
||||
);
|
||||
const shapePainterObject = new gd.ShapePainterObject('MyShapePainterObject');
|
||||
const adMobObject = new gd.AdMobObject('MyAdMobObject');
|
||||
const textObject = new gd.TextObject('MyTextObject');
|
||||
const tiledSpriteObject = new gd.TiledSpriteObject(
|
||||
'MyTiledSpriteObject'
|
||||
);
|
||||
const panelSpriteObject = new gd.PanelSpriteObject(
|
||||
'MyPanelSpriteObject'
|
||||
);
|
||||
const tiledSpriteObject = new gd.TiledSpriteObject('MyTiledSpriteObject');
|
||||
const panelSpriteObject = new gd.PanelSpriteObject('MyPanelSpriteObject');
|
||||
const spriteObject = new gd.SpriteObject('MySpriteObject');
|
||||
const spriteObjectWithBehaviors = new gd.SpriteObject(
|
||||
'MySpriteObjectWithBehaviors'
|
||||
@@ -62,7 +56,7 @@ export const makeTestProject = gd => {
|
||||
sprite1.getOrigin().setY(20);
|
||||
sprite1.getCenter().setX(100);
|
||||
sprite1.getCenter().setY(200);
|
||||
const headCustomPoint = new gd.Point("Head");
|
||||
const headCustomPoint = new gd.Point('Head');
|
||||
headCustomPoint.setX(40);
|
||||
headCustomPoint.setY(50);
|
||||
sprite1.addPoint(headCustomPoint);
|
||||
@@ -136,13 +130,20 @@ export const makeTestProject = gd => {
|
||||
|
||||
//Add a few variables
|
||||
const testLayoutVariables = testLayout.getVariables();
|
||||
testLayoutVariables.insert("Variable1", new gd.Variable(), 0).setString("A multiline\nstr value");
|
||||
testLayoutVariables.insert("Variable2", new gd.Variable(), 1).setString("123456");
|
||||
testLayoutVariables
|
||||
.insert('Variable1', new gd.Variable(), 0)
|
||||
.setString('A multiline\nstr value');
|
||||
testLayoutVariables
|
||||
.insert('Variable2', new gd.Variable(), 1)
|
||||
.setString('123456');
|
||||
const variable3 = new gd.Variable();
|
||||
variable3.getChild("Child1").setString("Child1 str value");
|
||||
variable3.getChild("Child2").setString("7891011");
|
||||
variable3.getChild("Child3").getChild("SubChild1").setString("Hello\nMultiline\nWorld");
|
||||
testLayoutVariables.insert("Variable3", variable3, 2);
|
||||
variable3.getChild('Child1').setString('Child1 str value');
|
||||
variable3.getChild('Child2').setString('7891011');
|
||||
variable3
|
||||
.getChild('Child3')
|
||||
.getChild('SubChild1')
|
||||
.setString('Hello\nMultiline\nWorld');
|
||||
testLayoutVariables.insert('Variable3', variable3, 2);
|
||||
|
||||
//Create a few events
|
||||
//Add a new "standard" event to the scene:
|
||||
@@ -236,8 +237,14 @@ export const makeTestProject = gd => {
|
||||
project.insertObject(globalTiledSpriteObject, 0);
|
||||
|
||||
// External events
|
||||
const testExternalEvents1 = project.insertNewExternalEvents('TestExternalEvents1', 0);
|
||||
const testExternalEvents2 = project.insertNewExternalEvents('TestExternalEvents2', 1);
|
||||
const testExternalEvents1 = project.insertNewExternalEvents(
|
||||
'TestExternalEvents1',
|
||||
0
|
||||
);
|
||||
const testExternalEvents2 = project.insertNewExternalEvents(
|
||||
'TestExternalEvents2',
|
||||
1
|
||||
);
|
||||
|
||||
return {
|
||||
project,
|
||||
|
@@ -6,13 +6,13 @@ export default class ValueStateHolder extends Component {
|
||||
|
||||
this.state = {
|
||||
value: props.initialValue,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return React.cloneElement(this.props.children, {
|
||||
onChange: value => this.setState({value}),
|
||||
onChange: value => this.setState({ value }),
|
||||
value: this.state.value,
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -131,7 +131,9 @@ storiesOf('ParameterFields', module)
|
||||
</ValueStateHolder>
|
||||
))
|
||||
.add('StringField', () => (
|
||||
<ValueStateHolder initialValue={'ToString(0) + "Test" + NewLine() + VariableString(MyVar)'}>
|
||||
<ValueStateHolder
|
||||
initialValue={'ToString(0) + "Test" + NewLine() + VariableString(MyVar)'}
|
||||
>
|
||||
<StringField
|
||||
project={project}
|
||||
layout={testLayout}
|
||||
@@ -231,7 +233,8 @@ storiesOf('ExpressionSelector', module)
|
||||
expressionType="number"
|
||||
onChoose={action('Expression chosen')}
|
||||
/>
|
||||
)).add('string', () => (
|
||||
))
|
||||
.add('string', () => (
|
||||
<ExpressionSelector
|
||||
selectedType=""
|
||||
expressionType="string"
|
||||
|
Reference in New Issue
Block a user