sxoinas12 5 years ago
parent
commit
81018ffd76
5 changed files with 46 additions and 5 deletions
  1. 2 1
      Systems/Gui.js
  2. 2 0
      Systems/ToolBox.js
  3. 40 3
      Tools/add.js
  4. 1 0
      Tools/select.js
  5. 1 1
      package-lock.json

+ 2 - 1
Systems/Gui.js

@@ -214,7 +214,8 @@ const styles = StyleSheet.create({
     backgroundColor: 'white',
     borderWidth: 4,
     borderColor: 'orange',
-
+    flex:1,
+    alignSelf: 'stretch',
     // iphone X
     width:1125/3,
     height: 2436/3 

+ 2 - 0
Systems/ToolBox.js

@@ -24,6 +24,8 @@ export default class ToolBox {
 	on(e) { return this.activeTool.on(e) }
 
 	editNode(View){
+		console.log("@@@@@@@ wHTTTATATATA")
+		console.log(View)
 		return this.activeTool.editViewNode(this.CoreSystem,View);
 	}
 

+ 40 - 3
Tools/add.js

@@ -2,15 +2,52 @@ import Tool from '../Systems/Tool';
 import { View , Text , Button , TextInput , StyleSheet} from 'react-native';
 import { Icon } from 'react-native-elements'
 import React from 'react';
+
+
+
+import Library from 'trapilib/dist/lib';
+
+let {
+	CoreSystem,
+	ViewSystem,
+	ViewNode,
+	Node
+} = Library; 
 export default class Add extends Tool{
 	constructor(){
 		super()
+		this.selectedNode = null;
 	}
 
 
-	editViewNode(node){
-		console.log("I have the node here now i can manipulate the Dom by addind")
-		console.log(node)
+	editViewNode(CS,node){
+		if(!node) return;
+		
+		if( this.selectedNode ) {
+			this.selectedNode.props.selected = false;
+			
+		}
+		node.props = {
+			...node.props,
+			selected: true
+		}
+
+		this.selectedNode = node;
+		let viewName = CS.Routing.getCurrentView();
+		let View = CS.ViewSystem.getView(viewName);
+		let rows = View.getRows(this.selectedNode);
+		View.setRows(this.selectedNode,rows.length + 1)
+		rows = View.getRows(this.selectedNode)
+
+		console.log(rows[rows.length-1])
+
+		View.setColumns(rows[rows.length-1],1)
+		rows[rows.length-1].props.selected = true;
+/*
+		rows.forEach((row) => {
+			View.setColumns(row,1);
+			row.props.selected = true})
+		*/
 	}
 
 

+ 1 - 0
Tools/select.js

@@ -45,6 +45,7 @@ export default class Select extends Tool{
 	editViewNode(CS,node){
 		if(!node) return;
 		
+		
 		if( this.selectedNode ) {
 			this.selectedNode.props.selected = false;
 			this.selectedNodeParent.props.selected = false;

+ 1 - 1
package-lock.json

@@ -7010,7 +7010,7 @@
       "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
     },
     "trapilib": {
-      "version": "git+http://git.onarbooks.com/Klapi/TrapiLib.git#683bf9a9e4e3224c4558dfd52b6304b223165c2e",
+      "version": "git+http://git.onarbooks.com/Klapi/TrapiLib.git#da73d3ecb6954dc29181c8a001c86d605ea52d73",
       "from": "git+http://git.onarbooks.com/Klapi/TrapiLib.git",
       "requires": {
         "expo": "^34.0.0-experiment.8",