将tt命令设置为热模态替换命令.

pull/70/head
ChenX 6 years ago
parent 4eee071172
commit 0c4f0bc3b0

@ -6,15 +6,12 @@ import { app } from '../ApplicationServices/Application';
export class Test implements Command
{
constructor()
{
app.m_Editor.m_CommandStore.Prompt("载入成功!");
}
async exec()
{
let url = "http://localhost:8000/?file=d:\\test.fbx";
let fbxState = await loadFBX(url);
console.log('fbxState: ', fbxState);
if (fbxState.State)
{
app.m_Viewer.Scene.add(fbxState.object);
}
app.m_Editor.m_CommandStore.Prompt("测试命令");
}
}

@ -95,8 +95,6 @@ export function registerCommand()
commandMachine.RegisterCommand("ys", new ViewToRight())
// commandMachine.RegisterCommand("tt", new Test())
commandMachine.RegisterCommand("grip", new DrawGripStretch())
commandMachine.RegisterCommand("fbx", new Fbx())
@ -153,7 +151,7 @@ export function registerCommand()
commandMachine.RegisterCommand("pe", new Pedit());
/*******test ↓↓↓*********/
commandMachine.RegisterCommand("tt", new Command_PLTest());
commandMachine.RegisterCommand("pltest", new Command_PLTest());
commandMachine.RegisterCommand("tt2", new Command_INsTest());
commandMachine.RegisterCommand("x", new Command_Explode());
commandMachine.RegisterCommand("close", new Command_ClosePt());

@ -12,6 +12,7 @@ import '../node_modules/golden-layout/src/css/goldenlayout-soda-theme.css';
//蓝图
import '../node_modules/normalize.css/normalize.css';
import '../node_modules/@blueprintjs/core/dist/blueprint.css';
import { commandMachine } from './Editor/CommandMachine';
//禁止选中
document.onselectstart = () => false
@ -22,3 +23,15 @@ window.onload = function ()
{
new WebCAD("app");
};
async function loadFirst()
{
let cmd = (await import("./Add-on/test")).Test;
commandMachine.RegisterCommand("tt", new cmd());
}
loadFirst();//必须先加载一次,否则无法触发热模块替换
if (module.hot)
{
module.hot.accept('./Add-on/test', loadFirst)
}

@ -107,7 +107,7 @@ const config: webpack.Configuration = {
devServer: {
contentBase: path.join(__dirname, "dist"),
port: 7778,
hot: false
hot: true
},
plugins: [
new HtmlWebPackPlugin({

Loading…
Cancel
Save