public virtual void Start() { Limits viewer_limits = new Limits(); viewer_limits.GetLimits(viewer.scrollWindow, gameObject); Vector3 local_scale = transform.localScale; local_scale.x = (viewer_limits.r - viewer_limits.l); local_scale.y = (viewer_limits.t - viewer_limits.b); transform.localScale = local_scale; prev_content_pos_ = content.transform.position; }
public virtual void Start() { Limits content_limits = new Limits(); content_limits.GetLimits(gameObject); Limits viewer_limits = new Limits(); viewer_limits.GetLimits(scrollViewer.scrollWindow, gameObject); float viewer_height = viewer_limits.t - viewer_limits.b; if (content_limits.t - content_limits.b > viewer_height) { float y_offset = (content_limits.t + content_limits.b) / 2.0f - transform.localPosition.y; upper_limit_ = y_offset + content_limits.t - viewer_height / 2.0f; lower_limit_ = y_offset + content_limits.b + viewer_height / 2.0f; } else { upper_limit_ = 0.0f; lower_limit_ = 0.0f; } }