更改了x6群组
This commit is contained in:
parent
25bd5c5560
commit
3c042f042e
|
@ -88,9 +88,9 @@ export default {
|
||||||
this.graph.getNodes().forEach((node) => {
|
this.graph.getNodes().forEach((node) => {
|
||||||
let mapPoint = node.store.data.mapPoint
|
let mapPoint = node.store.data.mapPoint
|
||||||
//由地理位置转换为屏幕位置
|
//由地理位置转换为屏幕位置
|
||||||
var lnglat = new TMap.LatLng(mapPoint.lat,mapPoint.lng)
|
var lnglat = new TMap.LatLng(mapPoint.lat, mapPoint.lng)
|
||||||
var pixel = this.map.projectToContainer(lnglat);
|
var pixel = this.map.projectToContainer(lnglat);
|
||||||
let x6postion=this.graph.pageToLocal(pixel.round().x, pixel.round().y)
|
let x6postion = this.graph.pageToLocal(pixel.round().x, pixel.round().y)
|
||||||
node.position(x6postion.x, x6postion.y);
|
node.position(x6postion.x, x6postion.y);
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -211,8 +211,8 @@ export default {
|
||||||
center: new TMap.LatLng(39.984104, 116.307503),// 设置地图中心点坐标
|
center: new TMap.LatLng(39.984104, 116.307503),// 设置地图中心点坐标
|
||||||
keyboardShortcuts: false, //设置禁止通过键盘控制地图。默认情况下启用键盘快捷键。
|
keyboardShortcuts: false, //设置禁止通过键盘控制地图。默认情况下启用键盘快捷键。
|
||||||
scrollwheel: false,
|
scrollwheel: false,
|
||||||
scrollable:false,
|
scrollable: false,
|
||||||
doubleClickZoom:false
|
doubleClickZoom: false
|
||||||
});
|
});
|
||||||
var mapContainer = document.getElementById('container');
|
var mapContainer = document.getElementById('container');
|
||||||
var x6 = document.getElementsByClassName("x6-content");
|
var x6 = document.getElementsByClassName("x6-content");
|
||||||
|
@ -265,8 +265,7 @@ export default {
|
||||||
})
|
})
|
||||||
this.map = map;
|
this.map = map;
|
||||||
this.map.on('pan', (e) => {
|
this.map.on('pan', (e) => {
|
||||||
this.onRender();
|
this.onRender();
|
||||||
// console.log(this.dataNodes);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
this.map.on('dragend', (e) => {
|
this.map.on('dragend', (e) => {
|
||||||
|
@ -492,8 +491,18 @@ this.onRender();
|
||||||
// this.pixelToPoint(args.node, args.node.store.data.position)
|
// this.pixelToPoint(args.node, args.node.store.data.position)
|
||||||
})
|
})
|
||||||
this.graph.on('node:mouseup', (args) => {
|
this.graph.on('node:mouseup', (args) => {
|
||||||
|
const container = this.$refs.container
|
||||||
|
const ports = container.querySelectorAll(
|
||||||
|
'.x6-port-body',
|
||||||
|
)
|
||||||
|
console.log(ports);
|
||||||
|
this.graph.getNodes().forEach((node) => {
|
||||||
|
//let mapPoint = node.store.data.mapPoint
|
||||||
|
this.pixelToPoint(node, node.store.data.position)
|
||||||
|
|
||||||
|
})
|
||||||
//将在容器的位置坐标转换为地图的地理坐标
|
//将在容器的位置坐标转换为地图的地理坐标
|
||||||
this.pixelToPoint(args.node, args.node.store.data.position)
|
//this.pixelToPoint(args.node, args.node.store.data.position)
|
||||||
})
|
})
|
||||||
//画布平移
|
//画布平移
|
||||||
// this.graph.on('translate', ({ tx, ty }) => {
|
// this.graph.on('translate', ({ tx, ty }) => {
|
||||||
|
@ -745,9 +754,9 @@ this.onRender();
|
||||||
pixelToPoint(node, position) {
|
pixelToPoint(node, position) {
|
||||||
//x6转屏幕
|
//x6转屏幕
|
||||||
console.log(position);
|
console.log(position);
|
||||||
let pmpostion=this.graph.localToPage(position.x, position.y);
|
let pmpostion = this.graph.localToPage(position.x, position.y);
|
||||||
console.log(pmpostion);
|
console.log(pmpostion);
|
||||||
let ePoint =this.map.unprojectFromContainer({x:pmpostion.x, y:pmpostion.y});
|
let ePoint = this.map.unprojectFromContainer({ x: pmpostion.x, y: pmpostion.y });
|
||||||
console.log(ePoint)
|
console.log(ePoint)
|
||||||
//let ePoint = this.map.containerToLngLat(new AMap.Pixel(position.x, position.y))
|
//let ePoint = this.map.containerToLngLat(new AMap.Pixel(position.x, position.y))
|
||||||
//将数据记录到node中
|
//将数据记录到node中
|
||||||
|
|
Loading…
Reference in New Issue