// Update is called once per frame void FixedUpdate() { if (Input.GetKeyDown(KeyCode.Escape)) { speed = 0f; ActiveScreen = UIName.Landing; } if (movementInitiated()) { //nextStep(); } move(); Vector3 transl = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0f) + new Vector3(0f, 0f, 25f * Input.GetAxis("Mouse ScrollWheel")); if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) { bool reverse = false; #if UNITY_IOS reverse = true; #endif var delts = Input.GetTouch(0).deltaPosition; transl -= new Vector3(reverse ? -1f * delts.y : delts.x, reverse ? delts.x : delts.y, 0f) * -0.0005f * transform.position.z; if (Input.touchCount == 2) { // Store both touches. Touch touchZero = Input.GetTouch(0); Touch touchOne = Input.GetTouch(1); // Find the position in the previous frame of each touch. Vector2 touchZeroPrevPos = touchZero.position - touchZero.deltaPosition; Vector2 touchOnePrevPos = touchOne.position - touchOne.deltaPosition; // Find the magnitude of the vector (the distance) between the touches in each frame. float prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude; float touchDeltaMag = (touchZero.position - touchOne.position).magnitude; // Find the difference in the distances between each frame. float deltaMagnitudeDiff = prevTouchDeltaMag - touchDeltaMag; transl -= new Vector3(0f, 0f, deltaMagnitudeDiff * -0.0005f * transform.position.z); } } if (transform.position.z + transl.z > -0.5f) //don't go down too far { transl += new Vector3(0f, 0f, -0.5f - transform.position.z); } if (movementEnabled) { transform.position += transl; elasticConnection.InitialMovementRelation += transl; } //show/hide the refresh button //Debug.Log(MapLabel.LabelCount); if (MapLabel.LabelCount == 0) { PowerUI.UI.document.getElementById("refreshButton").className = "button refreshButton landingButton"; } else { PowerUI.UI.document.getElementById("refreshButton").className = "button landingButton hidden"; } if (ActiveScreen == UIName.WhereFrom || ActiveScreen == UIName.WhereTo) //implement a scroll-by-swipe manually { if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) { string elId = ActiveScreen == UIName.WhereFrom ? "fromSearchResults" : "toSearchResults"; PowerUI.Element el = PowerUI.UI.document.getElementById(elId); var touch = Input.GetTouch(0); Vector2 scrollAmount = touch.deltaPosition; //(Input.GetTouch(0).position); Vector2 point = touch.position - scrollAmount; if (el.Style.Computed.Contains((int)point.x, (int)point.y)) { scrollAmount *= 5; el.scrollBy(0, (int)scrollAmount.y); } } } //Debug.Log(PowerUI.UI.document.getElementById("refreshButton").className); }