|
|
@ -243,29 +243,49 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
|
|
|
|
cu.Erase(false);
|
|
|
|
cu.Erase(false);
|
|
|
|
let moveCus = [cu];
|
|
|
|
let moveCus = [cu];
|
|
|
|
|
|
|
|
|
|
|
|
let store = RightPanelStore.GetInstance() as RightPanelStore;
|
|
|
|
let store = RightPanelStore.GetInstance();
|
|
|
|
|
|
|
|
|
|
|
|
//初始化造型数据,提取出形状
|
|
|
|
//初始化造型数据,提取出形状
|
|
|
|
store.modelingStore.InitModelingItems();
|
|
|
|
// store.modelingStore.InitModelingItems(); //需求:不重置配置
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let dataColorMap = new Map<string, number>();//data->color
|
|
|
|
|
|
|
|
let canUseColor: number[] = [];//可使用的颜色(无高度)
|
|
|
|
|
|
|
|
let onUseColor: number[] = [];//已经使用的颜色
|
|
|
|
let colorIndex = 1;
|
|
|
|
let colorIndex = 1;
|
|
|
|
let dataMap = new Map<string, number>();
|
|
|
|
for (let item of store.modelingStore.modelingItems)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let str = [item.height, item.dir, item.knifeRad, item.addLen].join("-");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dataColorMap.has(str) || item.height === 0)//重复的相同设定一样没有意义,所以可以覆盖
|
|
|
|
|
|
|
|
canUseColor.push(item.color);//可以被覆盖
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
dataColorMap.set(str, item.color);//记录颜色
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (let data of br.BoardModeling)
|
|
|
|
for (let data of br.BoardModeling)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let str = [data.thickness, data.dir, data.knifeRadius, data.addLen].join("-");
|
|
|
|
let str = [data.thickness, data.dir, data.knifeRadius, data.addLen].join("-");
|
|
|
|
let color: number;
|
|
|
|
let color: number;
|
|
|
|
if (dataMap.has(str))
|
|
|
|
if (dataColorMap.has(str))
|
|
|
|
color = dataMap.get(str);
|
|
|
|
color = dataColorMap.get(str);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
color = colorIndex;
|
|
|
|
color = canUseColor[0];
|
|
|
|
dataMap.set(str, color);
|
|
|
|
if (!color)
|
|
|
|
colorIndex++;
|
|
|
|
{
|
|
|
|
|
|
|
|
while (colorIndex < 24)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!onUseColor.includes(colorIndex)) break;
|
|
|
|
|
|
|
|
colorIndex++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
color = colorIndex;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
canUseColor.shift();
|
|
|
|
|
|
|
|
dataColorMap.set(str, color);
|
|
|
|
|
|
|
|
|
|
|
|
store.modelingStore.ChangeModelingValue(color - 1, data);
|
|
|
|
store.modelingStore.ChangeModelingValue(color - 1, data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onUseColor.push(color);
|
|
|
|
let cu = JigUtils.Draw(data.shape.Outline.Curve.Clone().Z0().ApplyMatrix(br.OCSNoClone));
|
|
|
|
let cu = JigUtils.Draw(data.shape.Outline.Curve.Clone().Z0().ApplyMatrix(br.OCSNoClone));
|
|
|
|
cu.ColorIndex = color;
|
|
|
|
cu.ColorIndex = color;
|
|
|
|
moveCus.push(cu);
|
|
|
|
moveCus.push(cu);
|
|
|
@ -284,7 +304,7 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//显示右侧状态栏
|
|
|
|
//显示右侧状态栏
|
|
|
|
store.modelingStore.isUpdate = false;
|
|
|
|
store.modelingStore.isUpdate = false;
|
|
|
|
store.modelingStore.configName = "";
|
|
|
|
//store.modelingStore.configName = ""; //需求:不重置配置
|
|
|
|
store.m_IsShow = true;
|
|
|
|
store.m_IsShow = true;
|
|
|
|
store.m_TabId = RightTabId.Model;
|
|
|
|
store.m_TabId = RightTabId.Model;
|
|
|
|
app.Editor.MaskManage.OnFocusEvent();
|
|
|
|
app.Editor.MaskManage.OnFocusEvent();
|
|
|
|