|
@@ -1148,13 +1148,6 @@ export class EditScence extends SGraphScene {
|
|
|
*
|
|
|
*/
|
|
|
copy(){
|
|
|
- // const input = document.createElement('input');
|
|
|
- // console.log(1111111111111111111)
|
|
|
- // input.value = 'sfsfsfsf'
|
|
|
- // document.body.appendChild(input);
|
|
|
- // input.select()
|
|
|
- // document.execCommand('copy');
|
|
|
- // input.style.display='none';
|
|
|
if (this.selectContainer.itemList.length) {
|
|
|
this.copyString = {
|
|
|
Nodes: [],
|
|
@@ -1172,7 +1165,19 @@ export class EditScence extends SGraphScene {
|
|
|
this.copyString[type].push(data)
|
|
|
}
|
|
|
})
|
|
|
+ // 生成复制字符串
|
|
|
console.log(this.copyString)
|
|
|
+ return
|
|
|
+ // 获取input dom
|
|
|
+ const input = document.createElement('input');
|
|
|
+ input.setAttribute('id', 'COPYINPUT')
|
|
|
+ input.value = JSON.stringify(this.copyString)
|
|
|
+ document.body.appendChild(input);
|
|
|
+ input.select()
|
|
|
+ document.execCommand('copy');
|
|
|
+ input.style.display='none';
|
|
|
+ console.log(input.value, Date.now());
|
|
|
+ document.body.removeChild(input)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1256,6 +1261,93 @@ export class EditScence extends SGraphScene {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 跨页面粘贴
|
|
|
+ *
|
|
|
+ */
|
|
|
+ crossPagePaste(crossPageString: string){
|
|
|
+ try {
|
|
|
+ console.log(crossPageString);
|
|
|
+ const pageObj = JSON.parse(crossPageString)
|
|
|
+
|
|
|
+ const parserData = new STopologyParser(null);
|
|
|
+ // 需要深拷贝
|
|
|
+ parserData.parseData(JSON.parse(JSON.stringify(pageObj)))
|
|
|
+ // 不需要复制区域
|
|
|
+ // parserData.zoneLegendList.forEach(t => {
|
|
|
+ // if (t instanceof SCustomLegendItem) {
|
|
|
+ // if (this.view) {
|
|
|
+ // t.pos.x += 10 / this.view.scale
|
|
|
+ // t.pos.y += 10 / this.view.scale
|
|
|
+ // }
|
|
|
+ // this.addItem(t)
|
|
|
+ // this.Nodes.push(t);
|
|
|
+ // graphItemList.push(t)
|
|
|
+ // }
|
|
|
+ // // 加到node
|
|
|
+ // // 加命令
|
|
|
+ // })
|
|
|
+ const graphItemList = [];
|
|
|
+ parserData.imageLegendList.forEach(t => {
|
|
|
+ if (this.view) {
|
|
|
+ t.pos.x += 10 / this.view.scale
|
|
|
+ t.pos.y += 10 / this.view.scale
|
|
|
+ }
|
|
|
+ t.moveable = true;
|
|
|
+ this.addItem(t)
|
|
|
+ this.Nodes.push(t);
|
|
|
+ graphItemList.push(t)
|
|
|
+ })
|
|
|
+ parserData.imageMarkerList.forEach(t => {
|
|
|
+ if (this.view) {
|
|
|
+ t.pos.x += 10 / this.view.scale
|
|
|
+ t.pos.y += 10 / this.view.scale
|
|
|
+ }
|
|
|
+ t.moveable = true;
|
|
|
+ this.addItem(t)
|
|
|
+ this.Markers.push(t);
|
|
|
+ graphItemList.push(t)
|
|
|
+ })
|
|
|
+ parserData.lineMarkerList.forEach(t => {
|
|
|
+ if (this.view) {
|
|
|
+ t.pos.x += 10 / this.view.scale
|
|
|
+ t.pos.y += 10 / this.view.scale
|
|
|
+ }
|
|
|
+ t.moveable = true;
|
|
|
+ this.addItem(t)
|
|
|
+ this.Markers.push(t);
|
|
|
+ graphItemList.push(t)
|
|
|
+ })
|
|
|
+ parserData.textMarkerList.forEach(t => {
|
|
|
+ if (this.view) {
|
|
|
+ t.pos.x += 10 / this.view.scale
|
|
|
+ t.pos.y += 10 / this.view.scale
|
|
|
+ }
|
|
|
+ t.moveable = true;
|
|
|
+ this.addItem(t)
|
|
|
+ this.Markers.push(t);
|
|
|
+ graphItemList.push(t)
|
|
|
+ })
|
|
|
+ parserData.relationList.forEach(t => {
|
|
|
+ if (this.view) {
|
|
|
+ t.pos.x += 10 / this.view.scale
|
|
|
+ t.pos.y += 10 / this.view.scale
|
|
|
+ t.moveToOrigin(t.pos.x, t.pos.y)
|
|
|
+ }
|
|
|
+ t.moveable = true;
|
|
|
+ this.addItem(t)
|
|
|
+ this.Relations.push(t);
|
|
|
+ graphItemList.push(t)
|
|
|
+ })
|
|
|
+ this.scenceUpdate(this);
|
|
|
+ if (graphItemList.length) {
|
|
|
+ this.AddListCommand(graphItemList)
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/** 类型转换 */
|
|
|
itemToType(obj:SGraphItem):String{
|
|
|
if (obj instanceof STextMarkerItem) {
|