|
|
|
@ -205,10 +205,62 @@ export default class ModuleBaseParams extends Component<{}, {}>
|
|
|
|
|
targetEl.onmousemove = null;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
ChangeRotate = async (e: number, ModifyModelStore: ModifyModelStore, axis: ModuleAxis) =>
|
|
|
|
|
{
|
|
|
|
|
if (!app.Editor.SelectCtrl.SelectSet.SelectEntityList.length) return;
|
|
|
|
|
const Command_KEY = '修改模型角度';
|
|
|
|
|
if (CommandState.CommandIng)
|
|
|
|
|
{
|
|
|
|
|
await app.Editor.ModalManage.EndExecingCmd();
|
|
|
|
|
if (CommandState.CommandIng)
|
|
|
|
|
{
|
|
|
|
|
AppToaster.show({
|
|
|
|
|
message: "命令正在执行中!无法修改模型角度!",
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
intent: Intent.DANGER,
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
commandMachine.CommandStart(Command_KEY);
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
commandMachine.CommandStart(Command_KEY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (axis)
|
|
|
|
|
{
|
|
|
|
|
case ModuleAxis.x: {
|
|
|
|
|
ModifyModelStore.rotateX = e;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ModuleAxis.y: {
|
|
|
|
|
ModifyModelStore.rotateY = e;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ModuleAxis.z: {
|
|
|
|
|
ModifyModelStore.rotateZ = e;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
for (let e of app.Editor.SelectCtrl.SelectSet.SelectEntityList)
|
|
|
|
|
{
|
|
|
|
|
ModifyModelStore.UpdateModuleRotate(e,
|
|
|
|
|
ModifyModelStore.rotateX,
|
|
|
|
|
ModifyModelStore.rotateY,
|
|
|
|
|
ModifyModelStore.rotateZ
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (CommandState.CommandIng && app.Database.hm.UndoData.CommandName === Command_KEY)
|
|
|
|
|
{
|
|
|
|
|
commandMachine.CommandEnd();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
ChangePosition = async (e: string, axis: ModuleAxis) =>
|
|
|
|
|
{
|
|
|
|
|
if (!app.Editor.SelectCtrl.SelectSet.SelectEntityList.length) return;
|
|
|
|
|
const ent = app.Editor.SelectCtrl.SelectSet.SelectEntityList[0];
|
|
|
|
|
let ents = app.Editor.SelectCtrl.SelectSet.SelectEntityList;
|
|
|
|
|
const Command_KEY = '修改模型位置';
|
|
|
|
|
if (CommandState.CommandIng)
|
|
|
|
|
{
|
|
|
|
@ -234,21 +286,25 @@ export default class ModuleBaseParams extends Component<{}, {}>
|
|
|
|
|
{
|
|
|
|
|
v = 0;
|
|
|
|
|
}
|
|
|
|
|
let move: number;
|
|
|
|
|
switch (axis)
|
|
|
|
|
{
|
|
|
|
|
case ModuleAxis.x: {
|
|
|
|
|
move = v - ModifyModelStore.positionX;
|
|
|
|
|
ModifyModelStore.positionX = v;
|
|
|
|
|
ModifyModelStore.UpdateModulePosition(ent, ModifyModelStore.positionX, ModuleAxis.x);
|
|
|
|
|
ModifyModelStore.UpdatePosition(ents, move, ModuleAxis.x);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ModuleAxis.y: {
|
|
|
|
|
move = v - ModifyModelStore.positionY;
|
|
|
|
|
ModifyModelStore.positionY = v;
|
|
|
|
|
ModifyModelStore.UpdateModulePosition(ent, ModifyModelStore.positionY, ModuleAxis.y);
|
|
|
|
|
ModifyModelStore.UpdatePosition(ents, move, ModuleAxis.y);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ModuleAxis.z: {
|
|
|
|
|
move = v - ModifyModelStore.positionZ;
|
|
|
|
|
ModifyModelStore.positionZ = v;
|
|
|
|
|
ModifyModelStore.UpdateModulePosition(ent, ModifyModelStore.positionZ, ModuleAxis.z);
|
|
|
|
|
ModifyModelStore.UpdatePosition(ents, move, ModuleAxis.z);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
@ -561,7 +617,7 @@ export default class ModuleBaseParams extends Component<{}, {}>
|
|
|
|
|
}} />
|
|
|
|
|
</div>
|
|
|
|
|
<div className='ParamsItem'>
|
|
|
|
|
<div className='ParamsPosition'>
|
|
|
|
|
<div className='ParamsPosition' style={{ width: 220 }}>
|
|
|
|
|
<span style={{ lineHeight: "24px" }}>位置</span>
|
|
|
|
|
<div>
|
|
|
|
|
<InputGroup
|
|
|
|
@ -571,6 +627,10 @@ export default class ModuleBaseParams extends Component<{}, {}>
|
|
|
|
|
this.ChangePosition(e.target.value, ModuleAxis.x);
|
|
|
|
|
}}
|
|
|
|
|
onPointerDown={(e) => { this.LetsMove(e, ModuleAxis.x); }}
|
|
|
|
|
onKeyDown={(e: React.KeyboardEvent) =>
|
|
|
|
|
{
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
@ -581,6 +641,10 @@ export default class ModuleBaseParams extends Component<{}, {}>
|
|
|
|
|
this.ChangePosition(e.target.value, ModuleAxis.y);
|
|
|
|
|
}}
|
|
|
|
|
onPointerDown={(e) => { this.LetsMove(e, ModuleAxis.y); }}
|
|
|
|
|
onKeyDown={(e: React.KeyboardEvent) =>
|
|
|
|
|
{
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
@ -591,11 +655,12 @@ export default class ModuleBaseParams extends Component<{}, {}>
|
|
|
|
|
this.ChangePosition(e.target.value, ModuleAxis.z);
|
|
|
|
|
}}
|
|
|
|
|
onPointerDown={(e) => { this.LetsMove(e, ModuleAxis.z); }}
|
|
|
|
|
onKeyDown={(e: React.KeyboardEvent) =>
|
|
|
|
|
{
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<Tooltip minimal placement='top' content='重置'>
|
|
|
|
|
<Button minimal small intent={Intent.PRIMARY} icon='redo' />
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className='ParamsItem' style={{ marginTop: "10px" }}>
|
|
|
|
@ -611,13 +676,20 @@ export default class ModuleBaseParams extends Component<{}, {}>
|
|
|
|
|
<Icon icon='record' size={8} style={{ color: "#FF0000" }} />
|
|
|
|
|
</div>
|
|
|
|
|
<NumericInput
|
|
|
|
|
selectAllOnFocus={true}
|
|
|
|
|
min={min}
|
|
|
|
|
max={max}
|
|
|
|
|
value={ModifyModelStore.rotateX.toFixed(0)}
|
|
|
|
|
onValueChange={(e: number) =>
|
|
|
|
|
{
|
|
|
|
|
ModifyModelStore.rotateX = e;
|
|
|
|
|
}} />
|
|
|
|
|
if (isNaN(e) || e < 0 || e > 360) return;
|
|
|
|
|
this.ChangeRotate(e, ModifyModelStore, ModuleAxis.x);
|
|
|
|
|
}}
|
|
|
|
|
onKeyDown={(e: React.KeyboardEvent) =>
|
|
|
|
|
{
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className='RotateY'>
|
|
|
|
@ -630,13 +702,20 @@ export default class ModuleBaseParams extends Component<{}, {}>
|
|
|
|
|
<Icon icon='record' size={8} style={{ color: "#00FF00" }} />
|
|
|
|
|
</div>
|
|
|
|
|
<NumericInput
|
|
|
|
|
selectAllOnFocus={true}
|
|
|
|
|
min={min}
|
|
|
|
|
max={max}
|
|
|
|
|
value={ModifyModelStore.rotateY.toFixed(0)}
|
|
|
|
|
onValueChange={(e: number) =>
|
|
|
|
|
{
|
|
|
|
|
ModifyModelStore.rotateY = e;
|
|
|
|
|
}} />
|
|
|
|
|
if (isNaN(e) || e < 0 || e > 360) return;
|
|
|
|
|
this.ChangeRotate(e, ModifyModelStore, ModuleAxis.y);
|
|
|
|
|
}}
|
|
|
|
|
onKeyDown={(e: React.KeyboardEvent) =>
|
|
|
|
|
{
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className='RotateZ'>
|
|
|
|
@ -649,17 +728,55 @@ export default class ModuleBaseParams extends Component<{}, {}>
|
|
|
|
|
<Icon icon='record' size={8} style={{ color: "#0000FF" }} />
|
|
|
|
|
</div>
|
|
|
|
|
<NumericInput
|
|
|
|
|
selectAllOnFocus={true}
|
|
|
|
|
min={min}
|
|
|
|
|
max={max}
|
|
|
|
|
value={ModifyModelStore.rotateZ.toFixed(0)}
|
|
|
|
|
onValueChange={(e: number) =>
|
|
|
|
|
{
|
|
|
|
|
ModifyModelStore.rotateZ = e;
|
|
|
|
|
}} />
|
|
|
|
|
if (isNaN(e) || e < 0 || e > 360) return;
|
|
|
|
|
this.ChangeRotate(e, ModifyModelStore, ModuleAxis.z);
|
|
|
|
|
}}
|
|
|
|
|
onKeyDown={(e: React.KeyboardEvent) =>
|
|
|
|
|
{
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<Tooltip minimal placement='top' content='重置'>
|
|
|
|
|
<Button minimal small intent={Intent.PRIMARY} icon='redo' />
|
|
|
|
|
<Button minimal small intent={Intent.PRIMARY} icon='redo'
|
|
|
|
|
onClick={async (e: React.MouseEvent) =>
|
|
|
|
|
{
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
if (app.Editor.SelectCtrl.SelectSet.SelectEntityList.length !== 1) return;
|
|
|
|
|
if (CommandState.CommandIng)
|
|
|
|
|
{
|
|
|
|
|
await app.Editor.ModalManage.EndExecingCmd();
|
|
|
|
|
if (CommandState.CommandIng)
|
|
|
|
|
{
|
|
|
|
|
AppToaster.show({
|
|
|
|
|
message: "命令正在执行中!无法修改模型角度!",
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
intent: Intent.DANGER,
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const Command_KEY = '修改模型角度';
|
|
|
|
|
commandMachine.CommandStart(Command_KEY);
|
|
|
|
|
for (let ent of app.Editor.SelectCtrl.SelectSet.SelectEntityList as EntityRef[])
|
|
|
|
|
{
|
|
|
|
|
ModifyModelStore.UpdateModuleRotate(ent, 0, 0, 0);
|
|
|
|
|
app.Viewer.UpdateRender();
|
|
|
|
|
}
|
|
|
|
|
commandMachine.CommandEnd();
|
|
|
|
|
}}
|
|
|
|
|
onKeyDown={(e: React.KeyboardEvent) =>
|
|
|
|
|
{
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|