@soonspacejs/plugin-drawing-topology 2.4.6 → 2.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function o(o){return function(o){if(Array.isArray(o))return s(o)}(o)||function(o){if("undefined"!=typeof Symbol&&null!=o[Symbol.iterator]||null!=o["@@iterator"])return Array.from(o)}(o)||function(o,e){if(!o)return;if("string"==typeof o)return s(o,e);var t=Object.prototype.toString.call(o).slice(8,-1);"Object"===t&&o.constructor&&(t=o.constructor.name);if("Map"===t||"Set"===t)return Array.from(o);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return s(o,e)}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(o,s){(null==s||s>o.length)&&(s=o.length);for(var e=0,t=new Array(s);e<s;e++)t[e]=o[e];return t}function e(o,s){for(var e=0;e<s.length;e++){var t=s[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(o,t.key,t)}}var t=function(){function s(o){!function(o,s){if(!(o instanceof s))throw new TypeError("Cannot call a class as a function")}(this,s),this.ssp=o,this.viewport=o.viewport,this.sceneMesh=[],this.nodes=[],this.topology=null,this.mouseDownNode=null,this.mouseMoveNode=null,this.options={id:"draing_topology",type:"line",nodes:[]},this.onMouseDowm=this.onMouseDowm.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onClick=this.onClick.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onRightClick=this.onRightClick.bind(this),this.onKeyUp=this.onKeyUp.bind(this)}var t,n,i;return t=s,(n=[{key:"start",value:function(o){this.options=o,this.sceneMesh=this.ssp.viewport.scener.intersectsList.getAll(),this.ssp.signals.mouseDown.add(this.onMouseDowm),this.ssp.signals.mouseMove.add(this.onMouseMove),this.ssp.signals.click.add(this.onClick),this.ssp.signals.dblClick.add(this.onDblClick),this.ssp.signals.rightClick.add(this.onRightClick),this.ssp.signals.keyUp.add(this.onKeyUp)}},{key:"stop",value:function(){this.nodes=[],this.mouseDownNode=null,this.mouseMoveNode=null,this.options={id:"draing_topology",type:"line",nodes:[]},this.ssp.signals.mouseDown.remove(this.onMouseDowm),this.ssp.signals.mouseMove.remove(this.onMouseMove),this.ssp.signals.click.remove(this.onClick),this.ssp.signals.dblClick.remove(this.onDblClick),this.ssp.signals.rightClick.remove(this.onRightClick),this.ssp.signals.keyUp.remove(this.onKeyUp)}},{key:"onMouseDowm",value:function(o){var s=this.ssp.viewport.getIntersects(o,this.sceneMesh);s.length>0&&(this.mouseDownNode={id:"node".concat(this.nodes.length+1),name:"node".concat(this.nodes.length+1),position:s[0].point.clone().setY(s[0].point.y+1),graphs:[]})}},{key:"onMouseMove",value:function(s){var e=this.ssp.viewport.getIntersects(s,this.sceneMesh);e.length>0&&(this.mouseMoveNode={id:"node".concat(this.nodes.length+1),name:"node".concat(this.nodes.length+1),position:e[0].point.clone().setY(e[0].point.y+1),graphs:[]},this.renderTopology([].concat(o(this.nodes),[this.mouseMoveNode])))}},{key:"onClick",value:function(o){this.mouseDownNode&&(this.nodes.push(this.mouseDownNode),this.renderTopology(this.nodes),this.mouseDownNode=null)}},{key:"onDblClick",value:function(s){this.mouseDownNode&&(this.nodes.push(this.mouseDownNode),this.renderTopology(this.nodes),this.mouseDownNode=null,this.options.onDone&&this.options.onDone(o(this.nodes)),this.stop())}},{key:"onRightClick",value:function(o){this.nodes.pop(),this.renderTopology(this.nodes)}},{key:"onKeyUp",value:function(s){switch(s.code){case"Backspace":this.nodes.pop(),this.renderTopology(this.nodes);break;case"Enter":this.options.onDone&&this.options.onDone(o(this.nodes)),this.renderTopology(this.nodes),this.stop();break;case"Escape":this.options.onCancel&&this.options.onCancel(),this.ssp.removeTopologyById(this.options.id),this.stop()}}},{key:"renderTopology",value:function(o){this.topology?this.ssp.resetTopologyNodes(this.topology,o):this.topology=this.ssp.createTopology(Object.assign(Object.assign({},this.options),{type:"line",nodes:o}))}}])&&e(t.prototype,n),i&&e(t,i),Object.defineProperty(t,"prototype",{writable:!1}),s}();export{t as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-drawing-topology",
|
|
3
3
|
"pluginName": "DrawingTopologyPlugin",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.9",
|
|
5
5
|
"description": "DrawingTopologyPlugin plugin for SoonSpace.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
],
|
|
14
14
|
"author": "xuek",
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "bc38cb459b7cd6894e492ffea333465fe423cdc5"
|
|
17
17
|
}
|