public void OnPinchEnd() { PinchHandler.SetPivot(this.content, new Vector2(0.5f, 0.5f)); if (this.PinchCompleted != null) { this.PinchCompleted(); } }
public void OnPinchStarted(Vector2 posOne, Vector2 posTwo) { if (this.TouchActionStarted != null) { this.TouchActionStarted(); } TLogger.Instance.Log("zoom start"); this._startPinchDist = this.Distance(posOne, posTwo) * this.content.localScale.x; this._startPinchZoom = this._currentZoom; this._startPinchScreenPosition = (posOne + posTwo) / 2f; RectTransformUtility.ScreenPointToLocalPointInRectangle(this.content, this._startPinchScreenPosition, null, out this._startPinchCenterPosition); Vector2 a = new Vector3(this.content.pivot.x * this.content.rect.size.x, this.content.pivot.y * this.content.rect.size.y); Vector2 vector = a + this._startPinchCenterPosition; PinchHandler.SetPivot(this.content, new Vector2(vector.x / this.content.rect.width, vector.y / this.content.rect.height)); }