import React from 'react'; import { StyleSheet, Text, TextInput, View } from 'react-native'; import GUI from './Systems/Gui'; import Mouse from './Systems/mouse'; import './App.css'; // let m1 = new Mouse(); // m1.on('LeftDown', () => console.log("M1")).listen(); // let m2 = new Mouse(); // m2.on('LeftDown', () => console.log("M2")).listen(); export default class App extends React.Component { constructor(props){ super(props) // this.playgroundRef = React.createRef(); // this.toolboxRef = React.createRef(); this.GUI = null; this.state = { zoom:1, scrollPos:0 } // this.addScrollEvent(); this.GUI = new GUI(); this.GUI.onUpdate( () => this.forceUpdate()) } componentDidMount() { this.GUI.onMount(); } addScrollEvent(){ window.addEventListener('wheel', (e) =>{ if(e.deltaY < 0){ this.zoom(0.2); } else if(e.deltaY > 0){ this.zoom(-0.2); } }); } zoom(delta){ let z = this.state.zoom; z = z + delta; this.setState({zoom:z}); } dragPage(e){ //!!!!!Import document.getElementById isnt working on react native //' let playground = document.getElementById("phone"); /*playground.addEventListener("mousedown",() => { console.log("mouse down") playground.onmousemove = function(e){ console.log("moving now while down") } })*/ } render(){ console.log("re render") let customStyle = { zoom: this.state.zoom }; return (