CircuitEdit1.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  1. <!-- 电路图编辑器页面 -->
  2. <template>
  3. <div>
  4. <div id="components-layout">
  5. <a-layout>
  6. <!-- {{tableDefaultData}} -->
  7. <a-layout-header>
  8. <a-button type="primary" style="margin-left: 20px" @click="testD"
  9. >保存</a-button
  10. >
  11. <!-- <a-button type="primary" style="margin-left: 20px" @click="testE"
  12. >载入模板</a-button
  13. > -->
  14. <a-button type="primary" style="margin-left: 20px" @click="testH"
  15. >预览</a-button
  16. >
  17. <a-button type="primary" style="margin-left: 20px" @click="deleteImg"
  18. >删除元器件</a-button
  19. >
  20. <!-- <a style="margin-left: 20px" href="https://svgv1.yaolunmao.top">
  21. <a-button type="primary">1.0版本</a-button>
  22. </a> -->
  23. <!-- <a style="margin-left: 20px" href="https://svgedit.yaolunmao.top">
  24. <a-button type="primary">在线绘图</a-button>
  25. </a> -->
  26. <!-- <a
  27. style="margin-left: 20px"
  28. href="https://github.com/yaolunmao/vue-webtopo-svgeditor"
  29. >
  30. <a-button type="primary">帮助</a-button>
  31. </a> -->
  32. </a-layout-header>
  33. <span v-if="!shrink" @click="exitFullscreen" class="icon-shrink svgfont"
  34. >&#xe62b;</span
  35. >
  36. <a-layout class="pageMain">
  37. <a-layout-sider class="leftNav">
  38. <LeftToolBar :svgInfoData="svgInfoData"></LeftToolBar>
  39. </a-layout-sider>
  40. <a-layout-content class="centerContain" :class="{ fixed: !shrink }">
  41. <div
  42. class="canvas-content"
  43. id="canvas"
  44. @mousemove="MouseMove"
  45. @mousedown="MousedownCanvas"
  46. @mouseup="MouseupCanvas"
  47. @dblclick="DblClick"
  48. @mousewheel="MouseWheel"
  49. >
  50. <!--拖动辅助线-->
  51. <div id="guide-x"></div>
  52. <div id="guide-y"></div>
  53. <!-- 画布 -->
  54. <svg
  55. version="1.1"
  56. xmlns="http://www.w3.org/2000/svg"
  57. xmlns:xlink="http://www.w3.org/1999/xlink"
  58. style="background-color: #000000"
  59. width="100%"
  60. height="100%"
  61. >
  62. <defs />
  63. <filter x="0" y="0" width="1" height="1" id="solid">
  64. <feFlood flood-color="rgb(255,255,255)" />
  65. <feComposite in="SourceGraphic" />
  66. </filter>
  67. <g
  68. style="cursor: pointer"
  69. v-for="(item, index) in svgLists"
  70. :key="index"
  71. :id="item.id"
  72. :type="item.type"
  73. @mousedown="
  74. MousedownSvg(
  75. item.id,
  76. index,
  77. item.svgPositionX,
  78. item.svgPositionY,
  79. $event
  80. )
  81. "
  82. :title="item.title"
  83. :transform="
  84. 'translate(' +
  85. item.svgPositionX +
  86. ',' +
  87. item.svgPositionY +
  88. ') rotate(' +
  89. item.angle +
  90. ') scale(' +
  91. item.size +
  92. ')'
  93. "
  94. >
  95. <SvgComponents
  96. :svg_color="item.svgColor"
  97. :svgInfoData="svgInfoData"
  98. :svgtype="item.type"
  99. :text="item.svgText"
  100. :size="item.size"
  101. :font-size="item.fontSize"
  102. :height="item.height"
  103. ></SvgComponents>
  104. </g>
  105. </svg>
  106. </div>
  107. </a-layout-content>
  108. <a-layout-sider class="rightNav">
  109. <RightToolBar
  110. :svgInfo="selectSvgInfo"
  111. @setTableAttr="setTableAttr"
  112. ></RightToolBar>
  113. </a-layout-sider>
  114. </a-layout>
  115. </a-layout>
  116. </div>
  117. </div>
  118. </template>
  119. <script>
  120. import LeftToolBar from "@/components/LeftToolBar.vue";
  121. import RightToolBar from "@/components/RightToolBar.vue";
  122. import global from "@/global/global.js"; //全局变量
  123. import SvgComponents from "@/components/SvgComponents.vue";
  124. import api from "@/api/site/systemImg";
  125. import { ElMessage } from "element-plus";
  126. export default {
  127. components: { LeftToolBar, RightToolBar, SvgComponents },
  128. data() {
  129. return {
  130. svgInfoData: [], //接口获取到的组件数据
  131. shrink: true, //收缩状态 true收缩 false展开
  132. svgLists: [], //svg列表
  133. //鼠标位置
  134. mousePosition: {
  135. positionX: "",
  136. positiony: "",
  137. },
  138. //辅助线元素
  139. guideX: "",
  140. guideY: "",
  141. CurrentlySelectedToolBar: {},
  142. selectSvg: {
  143. ID: "", //要移动的svg
  144. Index: 0,
  145. mouseStatus: 0, // 鼠标状态 1按下; 0弹起
  146. mPositionX: 0, //选中svg时鼠标的x轴坐标
  147. mPositionY: 0, //选中svg时鼠标的y轴坐标
  148. pointX: 0, //选中svg时svg的x轴坐标
  149. pointY: 0, //选中svg时svg的y轴坐标
  150. },
  151. selectSvgInfo: "",
  152. tableDefaultData: [],
  153. AnalogData: [],
  154. };
  155. },
  156. methods: {
  157. MouseMove(e) {
  158. let _this = this;
  159. if (this.selectSvg.mouseStatus == 0) {
  160. return;
  161. }
  162. const { clientX, clientY } = e;
  163. let svgID = this.svgLists[this.selectSvg.Index].id;
  164. //排除当前元素剩下的所有svg元素的列表
  165. let anyPositionList = this.svgLists.filter(function (list) {
  166. return list.id != svgID;
  167. });
  168. //将要移动的元素坐标设备为鼠标坐标
  169. let svgPositionX = this.selectSvg.pointX;
  170. let svgPositionY = this.selectSvg.pointY;
  171. svgPositionX += clientX - this.selectSvg.mPositionX;
  172. svgPositionY += clientY - this.selectSvg.mPositionY;
  173. setTimeout(function () {
  174. //少于十个像素自动吸附
  175. //从所有的x坐标列表中查与当前坐标少于10个像素的组件是否存在
  176. let exitsAdsorbX = anyPositionList.filter(function (list) {
  177. return (
  178. -10 < list.svgPositionX - svgPositionX &&
  179. list.svgPositionX - svgPositionX < 10
  180. );
  181. });
  182. if (exitsAdsorbX.length > 0) {
  183. svgPositionX = exitsAdsorbX[0].svgPositionX;
  184. }
  185. //y轴相同 横向坐标自动吸附
  186. let exitsAdsorbY = anyPositionList.filter(function (list) {
  187. return (
  188. -10 < list.svgPositionY - svgPositionY &&
  189. list.svgPositionY - svgPositionY < 10
  190. );
  191. });
  192. if (exitsAdsorbY.length > 0) {
  193. svgPositionY = exitsAdsorbY[0].svgPositionY;
  194. }
  195. _this.svgLists[_this.selectSvg.Index].svgPositionX = svgPositionX;
  196. _this.svgLists[_this.selectSvg.Index].svgPositionY = svgPositionY;
  197. //从所有的x坐标列表中查当前坐标是否存在
  198. let exitsNowX = anyPositionList.filter(function (list) {
  199. return list.svgPositionX === svgPositionX;
  200. });
  201. if (exitsNowX.length > 0) {
  202. _this.guideY.style.setProperty("left", svgPositionX - 1 + "px");
  203. _this.guideY.style.display = "inline";
  204. } else {
  205. _this.guideY.style.display = "none";
  206. }
  207. //从所有的y坐标列表中查当前坐标是否存在
  208. let exitsNowY = anyPositionList.filter(function (list) {
  209. return list.svgPositionY === svgPositionY;
  210. });
  211. if (exitsNowY.length > 0) {
  212. _this.guideX.style.setProperty("top", svgPositionY + "px");
  213. _this.guideX.style.display = "inline";
  214. } else {
  215. _this.guideX.style.display = "none";
  216. }
  217. }, 1);
  218. },
  219. MousedownCanvas() {
  220. // console.log('点击了画布');
  221. },
  222. MousedownSvg(id, index, pointX, pointY, e) {
  223. this.CurrentlySelectedToolBar.Type = global.CurrentlySelectedToolBarType =
  224. "";
  225. this.CurrentlySelectedToolBar.Title =
  226. global.CurrentlySelectedToolBarTitle = "";
  227. //从数组里面根据index找到当前元素
  228. this.selectSvg.ID = id;
  229. this.selectSvg.Index = index;
  230. this.selectSvg.mouseStatus = 1;
  231. this.selectSvg.mPositionX = e.clientX;
  232. this.selectSvg.mPositionY = e.clientY;
  233. this.selectSvg.pointX = pointX;
  234. this.selectSvg.pointY = pointY;
  235. // console.log(this.svgLists[index]);
  236. this.selectSvgInfo = this.svgLists[index];
  237. //获取所有g标签 将当前标签追加选中样式
  238. let gAnyList = document.querySelectorAll("g");
  239. gAnyList.forEach((g) => {
  240. g.classList.remove("topo-layer-view-selected");
  241. });
  242. document.getElementById(id).classList.add("topo-layer-view-selected");
  243. },
  244. MouseupCanvas() {
  245. this.guideX.style.display = "none";
  246. this.guideY.style.display = "none";
  247. if (
  248. this.CurrentlySelectedToolBar.Title != "" ||
  249. this.CurrentlySelectedToolBar.Type != ""
  250. ) {
  251. return;
  252. }
  253. // this.selectSvg.ID = '';
  254. this.selectSvg.mouseStatus = 0;
  255. },
  256. MouseWheel(e) {
  257. //获取当前选中组件
  258. let selectSvgInfo = this.selectSvgInfo;
  259. if (
  260. selectSvgInfo == undefined ||
  261. selectSvgInfo == null ||
  262. selectSvgInfo == ""
  263. ) {
  264. return;
  265. }
  266. e.preventDefault();
  267. //判断滚轮方向 -100是往上滑 100是下滑
  268. let svgZoom = e.deltaY < 0 ? 0.1 : -0.1;
  269. console.log(e.deltaY);
  270. selectSvgInfo.size += svgZoom;
  271. selectSvgInfo.size = parseFloat(selectSvgInfo.size.toFixed(1));
  272. if (selectSvgInfo.size < 1) {
  273. selectSvgInfo.size = 1;
  274. }
  275. },
  276. DblClick() {
  277. //获取所有g标签 清除所有选中样式
  278. let gAnyList = document.querySelectorAll("g");
  279. gAnyList.forEach((g) => {
  280. g.classList.remove("topo-layer-view-selected");
  281. });
  282. this.selectSvgInfo = "";
  283. },
  284. //保存事件
  285. testD() {
  286. var array = this.svgLists;
  287. array.map((val) => {
  288. val.siteId = this.$store.state.siteId;
  289. delete val.id;
  290. });
  291. if (this.svgLists.length > 0) {
  292. //请求保存接口
  293. api
  294. .setHookupComponentComplete(array)
  295. .then((requset) => {
  296. if (requset.status === "SUCCESS") {
  297. ElMessage.success("保存成功!");
  298. } else {
  299. ElMessage.error(requset.msg);
  300. }
  301. })
  302. .catch(function (error) {
  303. console.log(error);
  304. });
  305. } else {
  306. ElMessage("请先添加元器件!");
  307. }
  308. },
  309. //载入模板事件
  310. testE() {
  311. let _this = this;
  312. _this.$axios
  313. .get(window.PLATFROM_CONFIG.ione)
  314. .then(function (response) {
  315. console.log(response.data);
  316. response.data.map((val) => {
  317. _this.svgLists.push(val);
  318. });
  319. })
  320. .catch(function (error) {
  321. console.log(error);
  322. });
  323. // this.svgLists = this.AnalogData;
  324. },
  325. //预览事件
  326. testH() {
  327. var msg = "系统可能不会保存您所做的更改。";
  328. if (confirm(msg) == true) {
  329. localStorage.setItem("svginfo", JSON.stringify(this.svgLists));
  330. this.$router.push({
  331. path: "/Power_diagram",
  332. name: "power_diagram",
  333. });
  334. return true;
  335. } else {
  336. return false;
  337. }
  338. },
  339. //设置表格属性
  340. setTableAttr(id, rowCount, colCount) {
  341. // console.log(id, rowCount, colCount);
  342. //根据当前id找到当前表格的index
  343. let tableIndex = this.svgLists.indexOf(
  344. this.svgLists.filter((f) => f.id == id)[0]
  345. );
  346. if (tableIndex == -1) {
  347. return;
  348. }
  349. let svgType = this.svgLists.filter((f) => f.id == id)[0].type;
  350. if (svgType != "TableSvg") {
  351. return;
  352. }
  353. let tableData = [];
  354. for (let r = 0; r < rowCount; r++) {
  355. let tableColDataList = [];
  356. for (let c = 0; c < colCount; c++) {
  357. if (
  358. this.svgLists[tableIndex].tableData.length >= r + 1 &&
  359. this.svgLists[tableIndex].tableData[r].cols.length >= c + 1
  360. ) {
  361. tableColDataList.push(
  362. this.svgLists[tableIndex].tableData[r].cols[c]
  363. );
  364. } else {
  365. let tableColData = {
  366. id: this.$UCore.GenUUid(),
  367. val: `${r + 1}行${c + 1}列`,
  368. };
  369. tableColDataList.push(tableColData);
  370. }
  371. }
  372. let tableRowData = {
  373. cols: tableColDataList,
  374. };
  375. tableData.push(tableRowData);
  376. }
  377. console.log(tableData);
  378. this.svgLists[tableIndex].tableData = tableData;
  379. let gAnyList = document.querySelectorAll("foreignObject");
  380. let data = "";
  381. data += " <table class='.divtable'>";
  382. for (var j = 0; j < tableData.length; j++) {
  383. data += "<tr>";
  384. for (var i = 0; i < tableData[j].cols.length; i++) {
  385. data +=
  386. "<td><input id=" +
  387. tableData[j].cols[i].id +
  388. " type='text' class='input' value=" +
  389. tableData[j].cols[i].val +
  390. " ></td>";
  391. }
  392. data += "</tr>";
  393. }
  394. data += "</table>";
  395. gAnyList[0].innerHTML = data;
  396. document.getElementsByClassName(".divtable")[0].style = `
  397. position: absolute;
  398. left: 0;
  399. top: 0;
  400. line-height: 20px;
  401. z-index: 111;
  402. cursor: pointer;
  403. font-size: 20px;`;
  404. },
  405. //删除元器件事件
  406. deleteImg() {
  407. let _this = this;
  408. let selectSvgInfo = _this.selectSvgInfo;
  409. //根据当前id找到当前元素的index
  410. let selectSvgIndex = _this.svgLists.indexOf(
  411. _this.svgLists.filter((f) => f.id == selectSvgInfo.id)[0]
  412. );
  413. _this.svgLists.splice(selectSvgIndex, 1);
  414. },
  415. },
  416. mounted() {
  417. window.onbeforeunload = function (e) {
  418. e = e || window.event;
  419. // 兼容IE8和Firefox 4之前的版本
  420. if (e) {
  421. e.returnValue = "关闭提示";
  422. }
  423. // Chrome, Safari, Firefox 4+, Opera 12+ , IE 9+
  424. return "关闭提示";
  425. };
  426. let _this = this;
  427. let canvasdiv = document.querySelector("#canvas");
  428. _this.guideX = document.querySelector("#guide-x"); //辅助线x轴
  429. _this.guideY = document.querySelector("#guide-y"); //辅助线y轴
  430. canvasdiv.addEventListener(
  431. "dragover",
  432. function (e) {
  433. e.preventDefault();
  434. _this.CurrentlySelectedToolBar =
  435. global.CurrentlySelectedToolBarItem.array;
  436. },
  437. false
  438. );
  439. canvasdiv.addEventListener(
  440. "drop",
  441. function (e) {
  442. e.preventDefault();
  443. if (_this.CurrentlySelectedToolBar.type == "") {
  444. return;
  445. }
  446. //根据类型和鼠标位置创建组件
  447. let svgItem = JSON.parse(
  448. JSON.stringify(_this.CurrentlySelectedToolBar)
  449. );
  450. svgItem.id = _this.$UCore.GenUUid();
  451. svgItem.svgPositionX = e.offsetX;
  452. svgItem.svgPositionY = e.offsetY;
  453. _this.svgLists.push(svgItem);
  454. setTimeout(function () {
  455. //获取所有g标签 将当前标签追加选中样式
  456. let gAnyList = document.querySelectorAll("g");
  457. gAnyList.forEach((g) => {
  458. g.classList.remove("topo-layer-view-selected");
  459. });
  460. document
  461. .getElementById(svgItem.id)
  462. .classList.add("topo-layer-view-selected");
  463. _this.selectSvgInfo = svgItem;
  464. }, 100);
  465. },
  466. false
  467. );
  468. },
  469. unmounted() {
  470. window.onbeforeunload = null;
  471. },
  472. created() {
  473. let _this = this;
  474. //当前页面监视键盘输入
  475. document.onkeydown = function (e) {
  476. //获取当前选中组件
  477. let selectSvgInfo = _this.selectSvgInfo;
  478. if (
  479. selectSvgInfo == undefined ||
  480. selectSvgInfo == null ||
  481. selectSvgInfo == ""
  482. ) {
  483. return;
  484. }
  485. //事件对象兼容
  486. let e1 = e || window.event || arguments.callee.caller.arguments[0];
  487. //键盘按键判断:左箭头-37;上箭头-38;右箭头-39;下箭头-40
  488. if (e1 && e1.keyCode == 37) {
  489. e.preventDefault();
  490. selectSvgInfo.svgPositionX -= 1;
  491. } else if (e1 && e1.keyCode == 38) {
  492. e.preventDefault();
  493. selectSvgInfo.svgPositionY -= 1;
  494. } else if (e1 && e1.keyCode == 39) {
  495. e.preventDefault();
  496. selectSvgInfo.svgPositionX += 1;
  497. } else if (e1 && e1.keyCode == 40) {
  498. e.preventDefault();
  499. selectSvgInfo.svgPositionY += 1;
  500. }
  501. //ctrl c
  502. else if (e1 && e1.ctrlKey && e1.keyCode == 67) {
  503. e.preventDefault();
  504. let copySvgInfoStr = JSON.stringify(selectSvgInfo);
  505. let copySvgInfo = JSON.parse(copySvgInfoStr);
  506. copySvgInfo.id = _this.$UCore.GenUUid();
  507. copySvgInfo.svgPositionX = selectSvgInfo.svgPositionX + 10;
  508. copySvgInfo.svgPositionY = selectSvgInfo.svgPositionY + 10;
  509. _this.svgLists.push(copySvgInfo);
  510. _this.selectSvgInfo = copySvgInfo;
  511. setTimeout(function () {
  512. //获取所有g标签 将当前标签追加选中样式
  513. let gAnyList = document.querySelectorAll("g");
  514. gAnyList.forEach((g) => {
  515. g.classList.remove("topo-layer-view-selected");
  516. });
  517. document
  518. .getElementById(copySvgInfo.id)
  519. .classList.add("topo-layer-view-selected");
  520. }, 100);
  521. }
  522. //deleted
  523. else if (e1 && e1.keyCode == 46) {
  524. e.preventDefault();
  525. //根据当前id找到当前元素的index
  526. let selectSvgIndex = _this.svgLists.indexOf(
  527. _this.svgLists.filter((f) => f.id == selectSvgInfo.id)[0]
  528. );
  529. _this.svgLists.splice(selectSvgIndex, 1);
  530. }
  531. };
  532. //请求接口获取组件---->左侧基础数据
  533. api
  534. .gethookupComponentBasics()
  535. .then((requset) => {
  536. if (requset.status === "SUCCESS") {
  537. _this.svgInfoData = requset.data;
  538. } else {
  539. ElMessage.error(requset.msg);
  540. }
  541. })
  542. .catch(function (error) {
  543. console.log(error);
  544. });
  545. //请求接口获取组件---->list数据
  546. setTimeout(() => {
  547. api
  548. .getHookupComponentComplete({ siteId: this.$store.state.siteId })
  549. .then((requset) => {
  550. if (requset.data.length > 0) {
  551. _this.AnalogData = requset.data;
  552. _this.svgLists = JSON.parse(JSON.stringify(_this.AnalogData));
  553. } else {
  554. ElMessage.error(requset.msg);
  555. }
  556. })
  557. .catch(function (error) {
  558. console.log(error);
  559. });
  560. }, 1000);
  561. },
  562. };
  563. </script>
  564. <!-- Add "scoped" attribute to limit CSS to this component only -->
  565. <style scoped lang="less">
  566. ::-webkit-scrollbar {
  567. width: 8px;
  568. height: 8px;
  569. }
  570. ::-webkit-scrollbar-track {
  571. border-radius: 10px;
  572. background-color: #f2f2f2;
  573. box-shadow: 1px 1px 5px #333 inset;
  574. }
  575. ::-webkit-scrollbar-thumb {
  576. border-radius: 10px;
  577. background-color: #444;
  578. }
  579. #components-layout .ant-layout-header {
  580. position: absolute;
  581. left: 0;
  582. right: 0;
  583. top: 0;
  584. line-height: 50px;
  585. height: 50px;
  586. background: #fff;
  587. color: rgb(0, 0, 0);
  588. z-index: 2;
  589. box-shadow: 1px 1px 5px #ddd;
  590. }
  591. .tdsvg[data-v-025fdfb6] {
  592. border: 1px solid #ff0;
  593. white-space: nowrap;
  594. background: #fff;
  595. color: #999;
  596. text-align: center;
  597. font-size: 16px;
  598. background-color: #7cfc00;
  599. }
  600. foreignObject {
  601. width: 0;
  602. height: 0;
  603. overflow: visible;
  604. cursor: pointer;
  605. }
  606. .add-tag .ainput {
  607. display: inline-block;
  608. height: 100%;
  609. padding: 0 32px;
  610. pointer-events: auto;
  611. position: absolute;
  612. left: 0;
  613. width: 100%;
  614. caret-color: #426bf2;
  615. border-style: none;
  616. color: #ff0;
  617. background-color: #000;
  618. }
  619. .add-tag {
  620. color: #333;
  621. padding: 0;
  622. position: relative;
  623. }
  624. .pageMain {
  625. position: absolute;
  626. left: 0;
  627. right: 0;
  628. top: 50px;
  629. bottom: 0;
  630. overflow: auto;
  631. }
  632. .leftNav {
  633. position: absolute;
  634. left: 0;
  635. top: 0;
  636. bottom: 0;
  637. min-width: unset !important;
  638. max-width: unset !important;
  639. width: 260px !important;
  640. z-index: 1;
  641. overflow: auto;
  642. }
  643. .centerContain {
  644. position: absolute;
  645. left: 260px;
  646. right: 300px;
  647. top: 0;
  648. bottom: 0;
  649. z-index: 1;
  650. overflow: auto !important;
  651. overflow-x: auto !important;
  652. transition: all 0.3s;
  653. z-index: 111;
  654. &.fixed {
  655. position: fixed;
  656. left: 0;
  657. right: 0;
  658. top: 0;
  659. bottom: 0;
  660. }
  661. .canvas-content {
  662. width: 1920px;
  663. height: 1080px;
  664. }
  665. .btns-content {
  666. position: fixed;
  667. bottom: 10px;
  668. right: 320px;
  669. left: 280px;
  670. button {
  671. margin-left: 10px;
  672. }
  673. }
  674. }
  675. .rightNav {
  676. position: absolute;
  677. right: 0;
  678. top: 0;
  679. bottom: 0;
  680. min-width: unset !important;
  681. max-width: unset !important;
  682. width: 300px !important;
  683. z-index: 1;
  684. overflow: auto;
  685. }
  686. .icon-shrink {
  687. position: fixed;
  688. right: 20px;
  689. top: 5px;
  690. font-size: 24px;
  691. color: #fff;
  692. cursor: pointer;
  693. background: #1890ff;
  694. width: 38px;
  695. height: 38px;
  696. line-height: 38px;
  697. text-align: center;
  698. border-radius: 50%;
  699. user-select: none;
  700. z-index: 1111;
  701. }
  702. #components-layout .ant-layout-sider {
  703. background: #fff;
  704. color: rgb(167, 164, 164);
  705. }
  706. #guide-x {
  707. display: none;
  708. position: absolute;
  709. border-top: 1px dashed #55f;
  710. width: 100%;
  711. left: 0px;
  712. top: 500px;
  713. }
  714. #guide-y {
  715. display: none;
  716. position: absolute;
  717. border-left: 1px dashed #55f;
  718. height: 100%;
  719. left: 100px;
  720. top: 0px;
  721. }
  722. #canvas {
  723. -moz-user-select: none;
  724. -webkit-user-select: none;
  725. -ms-user-select: none;
  726. -khtml-user-select: none;
  727. user-select: none;
  728. }
  729. .ant-slider {
  730. margin-bottom: 16px;
  731. }
  732. .topo-layer {
  733. width: 100%;
  734. height: 100%;
  735. position: absolute;
  736. transform-origin: left top;
  737. overflow: auto;
  738. background-image: linear-gradient(
  739. 45deg,
  740. #ccc 25%,
  741. transparent 25%,
  742. transparent 75%,
  743. #ccc 75%,
  744. #ccc
  745. ),
  746. linear-gradient(
  747. 45deg,
  748. #ccc 25%,
  749. transparent 25%,
  750. transparent 75%,
  751. #ccc 75%,
  752. #ccc
  753. );
  754. background-size: 20px 20px;
  755. background-position: 0 0, 10px 10px;
  756. }
  757. .resize-left-top {
  758. position: absolute;
  759. height: 10px;
  760. width: 10px;
  761. background-color: white;
  762. border: 1px solid #0cf;
  763. left: -5px;
  764. top: -5px;
  765. cursor: nwse-resize;
  766. }
  767. .resize-left-bottom {
  768. position: absolute;
  769. height: 10px;
  770. width: 10px;
  771. background-color: white;
  772. border: 1px solid #0cf;
  773. left: -5px;
  774. bottom: -5px;
  775. cursor: nesw-resize;
  776. }
  777. .resize-right-top {
  778. position: absolute;
  779. height: 10px;
  780. width: 10px;
  781. background-color: white;
  782. border: 1px solid #0cf;
  783. right: -5px;
  784. top: -5px;
  785. cursor: nesw-resize;
  786. }
  787. .resize-right-bottom {
  788. position: absolute;
  789. height: 10px;
  790. width: 10px;
  791. background-color: white;
  792. border: 1px solid #0cf;
  793. right: -5px;
  794. bottom: -5px;
  795. cursor: nwse-resize;
  796. }
  797. .topo-layer-view-selected {
  798. outline: 1px solid #0cf;
  799. }
  800. </style>