Skip to content

Commit

Permalink
修改添加模式。
Browse files Browse the repository at this point in the history
  • Loading branch information
tengge1 committed Jan 11, 2020
1 parent ed4b5ad commit d62b202
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Supported Languages: 中文 / [繁體中文](README-tw.md) / [English](README-en
6. 修复添加不缩放文字,点击关闭按钮无法关闭窗口的bug。
7. 添加三维文字,支持数字、英文和汉字,支持保存载入。
8. 模型编辑中,新增模型下载功能。
9. `添加模式`改为保存在浏览器缓存中,默认改为`点击场景添加`模型。

## v0.4.0更新【[更新日志](docs-dev/update/UpdateLog.md)

Expand Down
3 changes: 0 additions & 3 deletions ShadowEditor.Web/src/Options.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ function Options(options = {}) {
// 天气
this.weather = ''; // ''-无,rain-下雨,snow-下雪

// 添加模式
this.addMode = 'center'; // center: 添加到场景中心;click: 点击场景添加。

// 物理引擎
this.enablePhysics = false; // 是否启用物理引擎
}
Expand Down
4 changes: 2 additions & 2 deletions ShadowEditor.Web/src/editor/assets/ModelPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ModelPanel extends React.Component {

return <div className={classNames('ModelPanel', className)}
style={style}
>
>
<SearchField
data={categoryData}
placeholder={_t('Search Content')}
Expand Down Expand Up @@ -145,7 +145,7 @@ class ModelPanel extends React.Component {
Server: true
});

if (app.options.addMode === 'click') {
if (app.storage.get('addMode') === 'click') {
this.clickSceneToAdd(obj);
} else {
this.addToCenter(obj);
Expand Down
7 changes: 4 additions & 3 deletions ShadowEditor.Web/src/editor/status/EditorStatusBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ class EditorStatusBar extends React.Component {

render() {
const { objects, vertices, triangles, showStats, showGrid, showViewHelper, isThrowBall } = this.state;
const { addMode, enablePhysics } = app.options;
const { enablePhysics } = app.options;

const selectMode = app.storage.get('selectMode');
const addMode = app.storage.get('addMode');
const controlMode = app.storage.get('controlMode');

const isLogin = !app.server.enableAuthority || app.server.isLogin;
Expand Down Expand Up @@ -215,8 +216,8 @@ class EditorStatusBar extends React.Component {
}

handleChangeAddMode(value) {
app.options.addMode = value;
app.call('optionChange', this, 'addMode', value);
app.storage.set('addMode', value);
app.call('storageChanged', this, 'addMode', value);
this.forceUpdate();
}

Expand Down
2 changes: 1 addition & 1 deletion ShadowEditor.Web/src/utils/Storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function Storage() {

// 添加模式
if (this.get('addMode') === undefined) {
this.set('addMode', 'center'); // center: 添加到场景中心;click: 点击场景添加。
this.set('addMode', 'click'); // center: 添加到场景中心;click: 点击场景添加。
}

// 控制器模式
Expand Down

0 comments on commit d62b202

Please sign in to comment.