隐藏websoket连接错误的报错信息.

pull/7/head
ChenX 7 years ago
parent 3e2782e401
commit ad05781dc4

@ -19,10 +19,17 @@ export class WebSocketClientServer
//ws连接. //ws连接.
private wsConnect() private wsConnect()
{ {
this.ws = new WebSocket("ws://localhost:8001/CADHost"); try
this.ws.onopen = this.wsOnOpen; {
this.ws.onmessage = this.wsOnMessage; this.ws = new WebSocket("ws://localhost:8001/CADHost");
this.ws.onclose = this.wsOnClose; this.ws.onopen = this.wsOnOpen;
this.ws.onmessage = this.wsOnMessage;
this.ws.onclose = this.wsOnClose;
} catch (error)
{
}
} }
private wsOnOpen = (event: Event) => private wsOnOpen = (event: Event) =>

@ -1,6 +1,6 @@
import * as THREE from 'three'; import * as THREE from 'three';
import { GetColorFormIndex, GetColorIndex } from '../Common/ColorPalette'; import { ColorMaterial } from '../Common/ColorPalette';
import { SetMaterial } from '../Common/SetMaterial'; import { SetMaterial } from '../Common/SetMaterial';
import { CameraControls } from '../Editor/CameraControls'; import { CameraControls } from '../Editor/CameraControls';
import { Viewer } from '../GraphicsSystem/Viewer'; import { Viewer } from '../GraphicsSystem/Viewer';
@ -61,7 +61,7 @@ export class WebCADView
// edge.applyMatrix(move) // edge.applyMatrix(move)
if (!color) color = 7; if (!color) color = 7;
var line = new THREE.LineSegments(edge, new THREE.LineBasicMaterial({ color: GetColorFormIndex(color) })); var line = new THREE.LineSegments(edge, ColorMaterial.GetLineMaterial(color));
line.userData = color; line.userData = color;
this.m_Viewer.m_Scene.add(line); this.m_Viewer.m_Scene.add(line);
@ -89,7 +89,7 @@ export class WebCADView
let fbxObj = await loadFBX(pathUrl + element.fileName); let fbxObj = await loadFBX(pathUrl + element.fileName);
if (fbxObj.State) if (fbxObj.State)
{ {
let Material = GetColorIndex(element.Color); let Material = ColorMaterial.GetLineMaterial(element.Color);
SetMaterial(fbxObj.object, Material); SetMaterial(fbxObj.object, Material);
this.m_Viewer.m_Scene.add(fbxObj.object); this.m_Viewer.m_Scene.add(fbxObj.object);
@ -173,7 +173,7 @@ export class WebCADView
} }
for (let e of this.m_EdgeEntitytList) for (let e of this.m_EdgeEntitytList)
{ {
(<THREE.LineBasicMaterial>e.material).color = GetColorFormIndex(7); (<THREE.LineBasicMaterial>e.material).color = ColorMaterial.GetColor(7);
} }
} }
EdgeShow() EdgeShow()
@ -184,7 +184,7 @@ export class WebCADView
} }
for (let e of this.m_EdgeEntitytList) for (let e of this.m_EdgeEntitytList)
{ {
(<THREE.LineBasicMaterial>e.material).color = GetColorFormIndex(e.userData); (<THREE.LineBasicMaterial>e.material).color = ColorMaterial.GetColor(e.userData);
} }
} }
} }
Loading…
Cancel
Save