Ver código fonte

Merge branch 'master' of http://git.onarbooks.com/Klapi/Editor

sxoinas12 5 anos atrás
pai
commit
205b264701
3 arquivos alterados com 16 adições e 16 exclusões
  1. 3 0
      Systems/Gui.js
  2. 12 15
      Systems/SideBar.js
  3. 1 1
      yarn.lock

+ 3 - 0
Systems/Gui.js

@@ -34,6 +34,9 @@ export default class Gui {
  		this.load();
     this.__onUpdate = null;
     this.SideBar = new SideBar(this.CoreSystem);
+    this.SideBar.onUpdate(() => {
+      this.forceUpdate();
+    })
     this.ToolBox.onUpdate( () =>{
       this.SideBar.tool = this.ToolBox.activeTool;
       this.forceUpdate();

+ 12 - 15
Systems/SideBar.js

@@ -13,7 +13,7 @@ export default class SideBar{
 		this.CoreSystem = CoreSystem;
 	}
 
-	onToolUpdate(props){
+	onUpdate(fn){
 		this.__onUpdate = fn
 	}
 
@@ -35,8 +35,10 @@ export default class SideBar{
      }
 
 
-    editNode(text,node){
-
+    editNode(text,key){
+    	console.log(text,key);
+    	this.viewNode.props[key] = text;
+    	this.forceUpdate();
     }
     //TODO Change everything :P
 	render(){
@@ -44,31 +46,26 @@ export default class SideBar{
 		console.log("@@@@@@@@@@@@@")
 		console.log(tool)
 		let ModuleSystem = this.CoreSystem.ModuleSystem;
-		let NodeProps = {};
+		let Structure = {};
 		if(tool){
 			if(tool.selectedNode && tool.selectedNode.content && tool.selectedNode.content.value){
-				let ctor = tool.selectedNode.content.value
-				let namespace = tool.selectedNode.content.namespace
+				this.viewNode = tool.selectedNode.content;
 				// give ViewNode
-				NodeProps = ModuleSystem.constructors[namespace][ctor].propTypes;
-				console.log(NodeProps);
+				Structure = ModuleSystem.fromViewNode(this.viewNode).Inputs;
+				console.log(Structure);
 			}	
 		}
-		let data = Object.keys(NodeProps || {}).map((key) => {
+		let data = Object.keys(Structure || {}).map((key) => {
 			return(
 				<View style={SideBarStyle.body}>
 					<Text>{key}</Text>
 					{key === 'text' ? (
 							<TextInput
 					        style={{height: 40, borderColor: 'gray', borderWidth: 1}}
-					        onChangeText={(text) => this.editNode(text,node)}
-					        value={NodeProps[key]}
+					        onChangeText={(text) => this.editNode(text, key)}
+					        value={this.viewNode.props[key]}
 					     	 />
 						):(null)}
-
-
-
-
 				</View>
 			)
 

+ 1 - 1
yarn.lock

@@ -5585,7 +5585,7 @@ [email protected]:
 
 "trapilib@git+http://git.onarbooks.com/Klapi/TrapiLib.git":
   version "1.0.7"
-  resolved "git+http://git.onarbooks.com/Klapi/TrapiLib.git#9c2388ba540ef72db55fc47c9b59a61ad0db4331"
+  resolved "git+http://git.onarbooks.com/Klapi/TrapiLib.git#f5204ea1c6b16f8695d3f208bfb0f411da2e7cf8"
   dependencies:
     expo "^34.0.0-experiment.8"
     prop-types "^15.7.2"