internal void CalculateOffset() { if (offsetByCameraY) { limit.OffsetY = ViewEnv.OffsetFromRelativeY(0).y; } }
//TODO need to compensate view extent public void InitWithCorner(Vector3 posTopLeft, Vector3 posBottomRight) { var system = ViewEnv.CameraSystem; var vTL = system.WorldToSystemXY(posTopLeft); var vBR = system.WorldToSystemXY(posBottomRight); var center = new Vector2(0.5f * (vTL.x + vBR.x), 0.5f * (vTL.y + vBR.y)) + ViewEnv.OffsetFromRelativeY(0); var extent = new Vector2(0.5f * Mathf.Abs(vTL.x - vBR.x), 0.5f * Mathf.Abs(vTL.y - vBR.y)); Init(extent, center); }