mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
修复bug。
This commit is contained in:
parent
535a119716
commit
07867fc28a
@ -1,4 +1,4 @@
|
||||
.Window.Confirm {
|
||||
width: 320px;
|
||||
height: 200px;
|
||||
height: 180px;
|
||||
}
|
||||
@ -86,7 +86,17 @@ Application.prototype.alert = function (title, content, onOK, onClose) {
|
||||
};
|
||||
|
||||
Application.prototype.confirm = function (title, content, onOK, onCancel) {
|
||||
let component = React.createElement(Confirm, {
|
||||
let component;
|
||||
|
||||
let close = () => {
|
||||
component && this.editor.removeComponent(component);
|
||||
};
|
||||
|
||||
if (onCancel === undefined) {
|
||||
onCancel = close;
|
||||
}
|
||||
|
||||
component = React.createElement(Confirm, {
|
||||
title,
|
||||
okText: L_OK,
|
||||
cancelText: L_CANCEL,
|
||||
@ -99,9 +109,7 @@ Application.prototype.confirm = function (title, content, onOK, onCancel) {
|
||||
|
||||
return {
|
||||
component,
|
||||
close: () => {
|
||||
this.editor.removeComponent(component);
|
||||
},
|
||||
close,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -110,9 +110,9 @@ class ScenePanel extends React.Component {
|
||||
}).then(obj => {
|
||||
this.onLoadScene(obj);
|
||||
|
||||
editor.sceneID = data.ID;
|
||||
editor.sceneName = data.Name;
|
||||
document.title = data.Name;
|
||||
editor.sceneID = data.id;
|
||||
editor.sceneName = data.title;
|
||||
document.title = data.title;
|
||||
|
||||
if (obj.options) {
|
||||
app.call('optionsChanged', this, app.options);
|
||||
|
||||
@ -11,13 +11,7 @@ class SceneMenu extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
emptyConfirmShow: false,
|
||||
};
|
||||
|
||||
this.handleCreateEmptyScene = this.handleCreateEmptyScene.bind(this);
|
||||
this.handleEmptyOK = this.handleEmptyOK.bind(this);
|
||||
|
||||
this.handleCreateGISScene = this.handleCreateGISScene.bind(this);
|
||||
this.handleSaveScene = this.handleSaveScene.bind(this);
|
||||
this.handleSaveAsScene = this.handleSaveAsScene.bind(this);
|
||||
@ -25,21 +19,16 @@ class SceneMenu extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
return <>
|
||||
<MenuItem title={L_SCENE}>
|
||||
<MenuItem title={L_NEW}>
|
||||
<MenuItem title={L_EMPTY_SCENE} onClick={this.handleCreateEmptyScene}></MenuItem>
|
||||
<MenuItem title={L_GIS_SCENE} onClick={this.handleCreateGISScene}></MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem title={L_SAVE} onClick={this.handleSaveScene}></MenuItem>
|
||||
<MenuItem title={L_SAVE_AS} onClick={this.handleSaveAsScene}></MenuItem>
|
||||
<MenuItemSeparator />
|
||||
<MenuItem title={L_EXPORT_SCENE} onClick={this.handleExportScene}></MenuItem>
|
||||
return <MenuItem title={L_SCENE}>
|
||||
<MenuItem title={L_NEW}>
|
||||
<MenuItem title={L_EMPTY_SCENE} onClick={this.handleCreateEmptyScene}></MenuItem>
|
||||
<MenuItem title={L_GIS_SCENE} onClick={this.handleCreateGISScene}></MenuItem>
|
||||
</MenuItem>
|
||||
{this.state.emptyConfirmShow && <Confirm
|
||||
title={L_CONFIRM}
|
||||
onOK={this.handleEmptyOK}>{L_UNSAVED_WILL_LOSE_CONFIRM}</Confirm>}
|
||||
</>;
|
||||
<MenuItem title={L_SAVE} onClick={this.handleSaveScene}></MenuItem>
|
||||
<MenuItem title={L_SAVE_AS} onClick={this.handleSaveAsScene}></MenuItem>
|
||||
<MenuItemSeparator />
|
||||
<MenuItem title={L_EXPORT_SCENE} onClick={this.handleExportScene}></MenuItem>
|
||||
</MenuItem>;
|
||||
}
|
||||
|
||||
// ---------------------------- 新建空场景 ---------------------------------
|
||||
@ -52,20 +41,18 @@ class SceneMenu extends React.Component {
|
||||
editor.sceneID = null;
|
||||
editor.sceneName = null;
|
||||
document.title = L_NO_NAME;
|
||||
UI.msg(L_CREATE_EMPTY_SCENE_SUCCESS);
|
||||
app.toast(L_CREATE_EMPTY_SCENE_SUCCESS);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({ emptyConfirmShow: true, });
|
||||
}
|
||||
|
||||
handleEmptyOK() {
|
||||
editor.clear();
|
||||
editor.sceneID = null;
|
||||
editor.sceneName = null;
|
||||
app.options.sceneType = 'Empty';
|
||||
document.title = L_NO_NAME;
|
||||
app.editor.camera.userData.control = 'OrbitControls';
|
||||
app.confirm(L_CONFIRM, L_UNSAVED_WILL_LOSE_CONFIRM, () => {
|
||||
editor.clear();
|
||||
editor.sceneID = null;
|
||||
editor.sceneName = null;
|
||||
app.options.sceneType = 'Empty';
|
||||
document.title = L_NO_NAME;
|
||||
app.editor.camera.userData.control = 'OrbitControls';
|
||||
});
|
||||
}
|
||||
|
||||
// --------------------------- 新建GIS场景 -------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user