Jelajahi Sumber

Visualize row cols

Nikatlas 5 tahun lalu
induk
melakukan
ebdd54141d
6 mengubah file dengan 63 tambahan dan 57 penghapusan
  1. 4 4
      Systems/Gui.js
  2. 3 3
      Systems/ToolBox.js
  3. 19 19
      Tools/select.js
  4. 3 0
      web/.expo/packager-info.json
  5. 7 0
      web/.expo/settings.json
  6. 27 31
      yarn.lock

+ 4 - 4
Systems/Gui.js

@@ -99,7 +99,7 @@ export default class Gui {
 
 	load() {
 	    this.CoreSystem = new CoreSystem();
-      this.ToolBox = new ToolBox(this.CoreSystem.ViewSystem);
+      this.ToolBox = new ToolBox(this.CoreSystem);
 	    try{
         let env = localStorage.getItem('environment');
         if( env === null){
@@ -116,8 +116,8 @@ export default class Gui {
 	processElement(event){
     console.log(event)
     console.log('sdasdwd')
-	  let ViewNode = this.CoreSystem.ray({event})
-	  let NewNode = this.ToolBox.editNode(ViewNode);
+	  let Node = this.CoreSystem.ray({event});
+	  let NewNode = this.ToolBox.editNode(Node);
     this.forceUpdate();
    }
 
@@ -172,7 +172,7 @@ export default class Gui {
 
 
 //jsLoad Test
-const jsLoad = '{"Routing":{"topology":{"nodes":{"test":{"id":"test","routeName":"test","uri":"test","view":"VS1","defaultLink":null}},"links":{"test":{"out":[],"in":[]}}},"home":"test"},"Views":{"views":{"VS1":{"tree":{"nodes":{"A":{"id":"A","depth":0,"value":"RootComp","namespace":"default","props":{"text":"This is the Starting point!!!Try add on me ","style":{"container":22,"text":23}}}},"links":{"A":{"out":[],"in":[]}},"levels":[["A"]],"rootId":"A"}}}}}'
+const jsLoad = '{"Routing":{"topology":{"nodes":{"test":{"id":"test","routeName":"test","uri":"test","view":"VS1","defaultLink":null}},"links":{"test":{"out":[],"in":[]}}},"home":"test"},"Views":{"views":{"VS1":{"tree":{"nodes":{"0.5907657036474692":{"id":0.5907657036474692,"depth":0,"isRow":true,"isCol":false},"0.51066596548815":{"id":0.51066596548815,"depth":1,"isRow":false,"isCol":true},"0.8855478722619232":{"id":0.8855478722619232,"depth":1,"isRow":false,"isCol":true,"content":{"id":"A","depth":null,"value":"RootComp","namespace":"default","props":{"text":"This is the Starting point!!!Try add on me ","style":{"container":22,"text":23}}}},"0.4630979404426283":{"id":0.4630979404426283,"depth":1,"isRow":false,"isCol":true},"0.7144981784945621":{"id":0.7144981784945621,"depth":2,"isRow":true,"isCol":false},"0.0666081688424911":{"id":0.0666081688424911,"depth":2,"isRow":true,"isCol":false}},"links":{"0.5907657036474692":{"out":[{"to":0.51066596548815,"from":0.5907657036474692},{"to":0.8855478722619232,"from":0.5907657036474692},{"to":0.4630979404426283,"from":0.5907657036474692}],"in":[]},"0.51066596548815":{"out":[],"in":[{"to":0.51066596548815,"from":0.5907657036474692}]},"0.8855478722619232":{"out":[{"to":0.7144981784945621,"from":0.8855478722619232},{"to":0.0666081688424911,"from":0.8855478722619232}],"in":[{"to":0.8855478722619232,"from":0.5907657036474692}]},"0.4630979404426283":{"out":[],"in":[{"to":0.4630979404426283,"from":0.5907657036474692}]},"0.7144981784945621":{"out":[],"in":[{"to":0.7144981784945621,"from":0.8855478722619232}]},"0.0666081688424911":{"out":[],"in":[{"to":0.0666081688424911,"from":0.8855478722619232}]}},"levels":[[0.5907657036474692],[0.51066596548815,0.8855478722619232,0.4630979404426283],[0.7144981784945621,0.0666081688424911]],"rootId":0.5907657036474692}}}}}'
 
 
 const styles = StyleSheet.create({

+ 3 - 3
Systems/ToolBox.js

@@ -11,8 +11,8 @@ function log(args){
 }
 
 export default class ToolBox{
-	constructor(ViewSystem){
-		this.ViewSystem = ViewSystem;
+	constructor(CoreSystem){
+		this.CoreSystem = CoreSystem;
 		this.tools = {};
 		this.loadTools();
 		this.activeTool = null;
@@ -24,7 +24,7 @@ export default class ToolBox{
 	on(e) { return this.activeTool.on(e) }
 
 	editNode(View){
-		return this.activeTool.editViewNode(this.ViewSystem,View);
+		return this.activeTool.editViewNode(this.CoreSystem,View);
 	}
 
 	onUpdate(fn){

+ 19 - 19
Tools/select.js

@@ -42,27 +42,27 @@ export default class Select extends Tool{
 		this.selectedNode = null;
 	}
 
-	editViewNode(VS,node){
-		if(!node || !node.id){
-			let unselect = StyleSheet.create({
-				container:{
-					padding:0,
-					borderWidth:0
-				}
-			})
-			if(this.selectedNode && this.selectedNode.props)
-				this.selectedNode.props.style.container = unselect.container;
-			this.selectedNode = null;
-			return;
+	editViewNode(CS,node){
+		if(!node) return;
+		
+		if( this.selectedNode ) {
+			this.selectedNode.props.selected = false;
+			this.selectedNodeParent.props.selected = false;
+		}
+
+		node.props = {
+			...node.props,
+			selected: true
 		}
 		this.selectedNode = node;
-		let style = StyleSheet.create({
-			container:{
-				padding:5,
-				borderWidth:2
-			}
-		})
-		node.props.style.container = style.container
+		let view = CS.Routing.getCurrentView();
+		console.log(view, CS.ViewSystem);
+		this.selectedNodeParent = CS.ViewSystem.views[view].getNode(CS.ViewSystem.views[view].getParent(node));
+		console.log(this.selectedNodeParent)
+		this.selectedNodeParent.props = {
+			...this.selectedNodeParent.props,
+			selected: true
+		}
 		//	let EditNode = new ViewNode(Math.random(),"ViewComp",{text:"Manipulationg the dom",style:styles})	
 		//VS.views[View].addViewNode(EditNode,node)
 		//VS.views[View].replace(node,EditNode);

+ 3 - 0
web/.expo/packager-info.json

@@ -0,0 +1,3 @@
+{
+  "devToolsPort": 19002
+}

+ 7 - 0
web/.expo/settings.json

@@ -0,0 +1,7 @@
+{
+  "hostType": "lan",
+  "lanType": "ip",
+  "dev": true,
+  "minify": false,
+  "urlRandomness": null
+}

+ 27 - 31
yarn.lock

@@ -840,9 +840,9 @@
     to-fast-properties "^2.0.0"
 
 "@expo/vector-icons@^10.0.1", "@expo/vector-icons@^10.0.2":
-  version "10.0.4"
-  resolved "https://registry.yarnpkg.com/@expo/vector-icons/-/vector-icons-10.0.4.tgz#61f8a41ef72d17c58e9175b864b02aec3b2b80b1"
-  integrity sha512-IZ9eM9CoSl2m+FtYJe/o+XFEAk6kq8YSjcxLsjDQImTz2IAfOx9QdT+Kwm0lBVBOqXdSZ/wi9gUFe7Fp9XuoTg==
+  version "10.0.5"
+  resolved "https://registry.yarnpkg.com/@expo/vector-icons/-/vector-icons-10.0.5.tgz#2464fd262613ad11c9b2d5c4227e85c164fcccf4"
+  integrity sha512-SWdAx2Qzxp5TgT3hZEoF/KHnaDW7ajIFztrDdaDZl3nPo7ExK0YiQ03V0z0xMd+uQwl3SZO3JMwPZ7YnuxcMEg==
   dependencies:
     lodash "^4.17.4"
 
@@ -1883,9 +1883,9 @@ [email protected]:
   integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
 
 electron-to-chromium@^1.3.191:
-  version "1.3.224"
-  resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.224.tgz#511abb2829a58c5ddb36c319094fe936bc82e3cd"
-  integrity sha512-vTH9UcMbi53x/pZKQrEcD83obE8agqQwUIx/G03/mpE1vzLm0KA3cHwuZXCysvxI1gXfNjV7Nu7Vjtp89kDzmg==
+  version "1.3.225"
+  resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.225.tgz#c6786475b5eb5f491ade01a78b82ba2c5bfdf72b"
+  integrity sha512-7W/L3jw7HYE+tUPbcVOGBmnSrlUmyZ/Uyg24QS7Vx0a9KodtNrN0r0Q/LyGHrcYMtw2rv7E49F/vTXwlV/fuaA==
 
 encodeurl@~1.0.2:
   version "1.0.2"
@@ -2898,9 +2898,9 @@ google-maps-infobox@^2.0.0:
   integrity sha512-hTuWmWZZSOxf5D/z7l3/hTF1grgRvLG53BEKMdjiKOG+FcK/kH7vqseUeyIU9Zj2ZIqKTOaro0nknxpAuRq4Vw==
 
 graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
-  version "4.2.1"
-  resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.1.tgz#1c1f0c364882c868f5bff6512146328336a11b1d"
-  integrity sha512-b9usnbDGnD928gJB3LrCmxoibr3VE4U2SMo5PBuBnokWyDADTqDPXg4YpwKF1trpH+UbGp7QLicO3+aWEy0+mw==
+  version "4.2.2"
+  resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02"
+  integrity sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==
 
 growly@^1.3.0:
   version "1.3.0"
@@ -2973,11 +2973,9 @@ hoist-non-react-statics@^3.1.0:
     react-is "^16.7.0"
 
 hosted-git-info@^2.1.4:
-  version "2.8.2"
-  resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.2.tgz#a35c3f355ac1249f1093c0c2a542ace8818c171a"
-  integrity sha512-CyjlXII6LMsPMyUzxpTt8fzh5QwzGqPmQXgY/Jyf4Zfp27t/FvfhwoE/8laaMUcMy816CkWF20I7NeQhwwY88w==
-  dependencies:
-    lru-cache "^5.1.1"
+  version "2.8.4"
+  resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.4.tgz#44119abaf4bc64692a16ace34700fed9c03e2546"
+  integrity sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ==
 
 http-errors@~1.7.2:
   version "1.7.3"
@@ -3527,13 +3525,6 @@ lru-cache@^4.0.1:
     pseudomap "^1.0.2"
     yallist "^2.1.2"
 
-lru-cache@^5.1.1:
-  version "5.1.1"
-  resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"
-  integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==
-  dependencies:
-    yallist "^3.0.2"
-
 make-dir@^2.0.0:
   version "2.1.0"
   resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5"
@@ -5037,9 +5028,9 @@ ret@~0.1.10:
   integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==
 
 rimraf@^2.5.4, rimraf@^2.6.1:
-  version "2.6.3"
-  resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab"
-  integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==
+  version "2.7.0"
+  resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.0.tgz#eb43198c5e2fb83b9323abee63bd87836f9a7c85"
+  integrity sha512-4Liqw7ccABzsWV5BzeZeGRSq7KWIgQYzOcmRDEwSX4WAawlQpcAFXZ1Kid72XYrjSnK5yxOS6Gez/iGusYE/Pw==
   dependencies:
     glob "^7.1.3"
 
@@ -5148,9 +5139,9 @@ scriptjs@^2.5.8:
   integrity sha512-qGVDoreyYiP1pkQnbnFAUIS5AjenNwwQBdl7zeos9etl+hYKWahjRTfzAZZYBv5xNHx7vNKCmaLDQZ6Fr2AEXg==
 
 "semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0:
-  version "5.7.0"
-  resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b"
-  integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==
+  version "5.7.1"
+  resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
+  integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
 
 semver@^6.3.0:
   version "6.3.0"
@@ -5228,7 +5219,7 @@ shebang-regex@^1.0.0:
   resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
   integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=
 
[email protected], shell-quote@^1.6.1:
[email protected]:
   version "1.6.1"
   resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767"
   integrity sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=
@@ -5238,6 +5229,11 @@ [email protected], shell-quote@^1.6.1:
     array-reduce "~0.0.0"
     jsonify "~0.0.0"
 
+shell-quote@^1.6.1:
+  version "1.7.1"
+  resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.1.tgz#3161d969886fb14f9140c65245a5dd19b6f0b06b"
+  integrity sha512-2kUqeAGnMAu6YrTPX4E3LfxacH9gKljzVjlkUeSqY0soGwK4KLl7TURXCem712tkhBCeeaFP9QK4dKn88s3Icg==
+
 shellwords@^0.1.1:
   version "0.1.1"
   resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
@@ -5583,8 +5579,8 @@ [email protected]:
   integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==
 
 "trapilib@git+http://git.onarbooks.com/Klapi/TrapiLib.git":
-  version "1.0.4"
-  resolved "git+http://git.onarbooks.com/Klapi/TrapiLib.git#d84aea3506f84fac7f3953bfd755a03a9b3f00be"
+  version "1.0.6"
+  resolved "git+http://git.onarbooks.com/Klapi/TrapiLib.git#4bc08b99a4baed2a1ac19a054ff10f992a89d7c9"
   dependencies:
     expo "^34.0.0-experiment.8"
     react "16.8.3"
@@ -5962,7 +5958,7 @@ yallist@^2.1.2:
   resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
   integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=
 
-yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3:
+yallist@^3.0.0, yallist@^3.0.3:
   version "3.0.3"
   resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9"
   integrity sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==