Commit b6b6ce08 authored by baoshuang's avatar baoshuang

xiugai

parent 3f9e7d2b
......@@ -85,14 +85,28 @@ class ModuleEdit extends Component {
},
editFlag: false,//编辑模式
showRightPanel: false, //是否显示右侧详情
simpleTipVisible: false //简单提示
simpleTipVisible: false, //简单提示
dragItem: '' //拖动的节点
};
this.nativeProps = {
onMouseDown: this.onMouseDown,
onMouseMove: this.onMouseMove
};
this.drowItem = '';
this.areas = []
this.areas = [],
this.areaStyles = {
normal:{
regionColor: '#02B00F', // 区域颜色
lineColor: '#00FF70', // 边框颜色
regionOpacity: 0.3
},
noDrop:{
regionColor: '#969696', // 区域颜色
lineColor: '#878787', // 边框颜色
regionOpacity: 0.4
}
},
getObjFromNet(view3dFile, (objs, asyncModels) => {
this.setState({
......@@ -155,20 +169,20 @@ class ModuleEdit extends Component {
// eslint-disable-next-line react/sort-comp
_registerEvents = () => {
this.r3d.on('dbclick', evt => {
this.r3d.on('click', evt => {
if (evt.button !== 0) {
return;
}
const object = evt.object;
if (object) {
this.cameraFactory.flyTo({
position: object.position.toArray(),
duration: 6000
});
// this.cameraFactory.flyTo({
// position: object.position.toArray(),
// duration: 6000
// });
}
});
this.r3d.on('keydown', evt => {
this.r3d.on('mousedown', evt => {
// 返回上级
if (this.lensLevel === LENS_LEVEL.SUB && evt.code === 'Backspace') {
this.lensJumpFactory.jumpRoot(obj => {
......@@ -194,14 +208,19 @@ class ModuleEdit extends Component {
}
this.setState({ totalDelta });
}
pointParamsChange = (object, modeType) => {
console.log("zzzzzzzzzzzzzz",object,modeType)
}
onGraphCreated = ({ cameraFactory, sceneFactory, outlineFactory, r3d, stagePilot }) => {
this.cameraFactory = cameraFactory;
this.sceneFactory = sceneFactory;
this.outlineFactory = outlineFactory;
this.r3d = r3d;
this.polygonRegion = {};
this.stagePilot = stagePilot;
this.positionCtl = stagePilot.positionCtl;
this.positionCtl.addListener('changeDone',this.pointParamsChange)
console.log(this)
// 重新设置 outline 风格
this.outlineFactory.outlineConfig = {
visibleEdgeColor: '#f8a303',
......@@ -500,17 +519,38 @@ class ModuleEdit extends Component {
}
getAreas = (treeData) => {
// let { treeData } = this.state;
let { dragItem } = this.state;
// console.log(treeData)
// let areas = [];
if (treeData&&treeData.length>0) {
treeData.map((item) => {
if (item.isRegion && item.isBind) {
if (item.children&&item.children.length > 0) {
this.areas.push(<PolygonRegion points={JSON.parse(item.routePath)} onCreated={this.onRegionCreated}/>)
if (dragItem) {
if ( dragItem.parentId && dragItem.parentId == item.id) {
this.areas.push(<PolygonRegion {...this.areaStyles.normal} points={JSON.parse(item.routePath)} onCreated={(e) => {this.onRegionCreated(e,item)}}/>)
} else {
this.areas.push(<PolygonRegion {...this.areaStyles.noDrop} points={JSON.parse(item.routePath)} onCreated={(e) => {this.onRegionCreated(e,item)}} />)
}
{this.getAreas(item.children)}
} else {
this.areas.push(<PolygonRegion {...this.areaStyles.normal} points={JSON.parse(item.routePath)} onCreated={(e) => {this.onRegionCreated(e,item)}} />)
{this.getAreas(item.children)}
}
this.areas.push(<PolygonRegion points={JSON.parse(item.routePath)} onCreated={this.onRegionCreated}/>)
}else {
if (dragItem) {
if ( dragItem&&dragItem.parentId && dragItem.parentId == item.id) {
this.areas.push(<PolygonRegion {...this.areaStyles.normal} points={JSON.parse(item.routePath)} onCreated={(e) => {this.onRegionCreated(e,item)}}/>)
} else {
this.areas.push(<PolygonRegion {...this.areaStyles.noDrop} points={JSON.parse(item.routePath)} onCreated={(e) => {this.onRegionCreated(e,item)}} />)
}
} else {
this.areas.push(<PolygonRegion {...this.areaStyles.normal} points={JSON.parse(item.routePath)} onCreated={(e) => {this.onRegionCreated(e,item)}}/>)
}
}
} else {
if (item.children&&item.children.length > 0) {
{this.getAreas(item.children)}
......@@ -522,15 +562,14 @@ class ModuleEdit extends Component {
renderAreas = () => {
this.areas = [];
this.getAreas(this.state.treeData);
// console.log(this.areas)
console.log(this.areas)
return this.areas;
}
onRegionCreated = (polygonRegion, item) => {
onRegionCreated = (polygonRegion,item) => {
console.log(polygonRegion)
console.log(item)
// console.log(polygonRegion.pointInPolygon)
this.polygonRegion = polygonRegion;
// console.log(e)
this.polygonRegion[item.id] = polygonRegion;
console.log(this.polygonRegion)
}
//保存区域绑定
saveAreaData = () => {
......@@ -626,6 +665,18 @@ class ModuleEdit extends Component {
dragItemChange = (dragItem) => {
this.state.dragItem = dragItem;
let { treeData } = this.state;
if (dragItem.isRegion) {
//是区域
} else {
if(dragItem.isBind) {
//已绑定
} else {
let hasRegion = false;
}
}
this.setState({
dragItem
})
......@@ -652,13 +703,21 @@ class ModuleEdit extends Component {
position = objs[0].point;
}
// [0,0,0]
const isInside = this.polygonRegion.pointInPolygon([position.x,position.y,position.z])
const isInside = this.polygonRegion[dragItem.parentId].pointInPolygon([position.x,position.y,position.z])
console.log(this.polygonRegion)
console.log(objs)
console.log(position)
console.log(position.x)
console.log(isInside)
if (dragItem) {
if (isInside == false) {
this.tipMsg = '只能放置在当前区域'
this.setState({
simpleTipVisible: true
})
return false;
}
let uid = UUID.uuidFast()
let addPointParam = {
type: dragItem.type,
......@@ -707,12 +766,27 @@ class ModuleEdit extends Component {
})
}
/** 拖拽元素外观(位置、缩放、旋转角度)改变 */
onTransformChange = (object, modeType) => {
modeType === 'translate' && (modeType = 'position');
modeType === 'rotate' && (modeType = 'rotation');
const basicAttr = (object.userData || {}).basicAttr;
basicAttr[modeType] = peelXYZFromObj(object, modeType);
const sketchOptions = {
key: 'basicAttr',
value: basicAttr
};
this.props.trigger(EVENTS_CONSTS.SKETCH_PARAMS_CHANGE, {
sketchId: (object.userData || {}).eid,
sketchOptions
});
};
render() {
const { fireEquipmentPosition, drawing, objs, markers, pageType, pointType, pointTypeArr, editFlag, showRightPanel, selectPoints, selectArea } = this.state;
console.log(this.state)
console.log(this.props)
console.log(this)
const { dimension } = this.props;
const graphicProps = {
...dimension,
......@@ -753,6 +827,7 @@ class ModuleEdit extends Component {
enableModelParser
disabledEdit
defaultLoading={false}
onTransformChange={this.onTransformChange}
ref={node => (this.a3dRef = node)}
baseObjs={objs}
drawing={drawing}
......@@ -824,7 +899,7 @@ class ModuleEdit extends Component {
noDefaultHeader
// onCancel={this.simpleTipCancel}
onOk = {this.simpleTipOk}
content={<div>内容区域...</div>}
content={<div>{this.tipMsg}</div>}
/>
</div>
......
......@@ -59,18 +59,22 @@ class PointsPoolEditPage extends Component {
// });
}
onMarkersCreated = (type, { markersCache }) => {
this.markerList[type] = markersCache;
let stagePilot = this.props.stagePilot;
if(markersCache&&stagePilot) {
console.log(this.markerList)
// console.log(this.markerList)
console.log(markersCache)
console.log(this.props)
markersCache.eachValue(item => stagePilot.positionCtl.objects.push(item.node) )
// console.log(this.props)
markersCache.eachValue(item => {
item.node._userData = { ...item.extData };
stagePilot.positionCtl.objects.push(item.node); })
}
(markersCache || []).forEach(mc => {
const extData = mc.getExtData();
// console.log('lllllllllllllllll',mc)
if (extData.hasOwnProperty('visible')){
let visible = extData.visible;
if (visible) {
......
......@@ -123,7 +123,6 @@ class PointLeftTree extends Component {
key={item.id}
dataRef={item}
onDragStart={() => {
console.log(11)
this.props.dragItemChange(item)
}}>
{this.renderTreeNodes(item.children)}
......
......@@ -48,14 +48,20 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
this.markerEvents = {
click: this.onMarkerClick,
mouseover: (marker) => {
console.log(marker)
marker.object2DPipe.pipeNode.visible = true;
marker.object2DPipe.pipeNode.elementVisible = true;
},
mouseout: (marker) => {
marker.object2DPipe.pipeNode.visible = false;
marker.object2DPipe.pipeNode.elementVisible = false;
},
mouseup: (evt) => {
console.log('------------------up')
console.log(evt)
}
};
this.state = {
isClick: true
};
......@@ -71,6 +77,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
onMarkerClick = (marker, e) => {
const { isClick } = this.state;
console.log("---click",marker)
if (isClick) {
this.setState({ isClick: false }); //将isClick 变成false,将不会执行处理事件
this.pdRef && this.pdRef.onOpenClick(marker);
......@@ -87,6 +94,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
const { markers, ...rest } = this.props;
const { planStarted } = this.state;
let dialogStyle = { zIndex: 1000 };
// console.log('zzzzzzzzzzzzzzzz')
const result = buildMarkerOptions(markers, markerType, markerParams);
return (
<WrappedComponent>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment