public override void Update() { UpdateBegin(); if (visible) { btn.Update(); if (btn.pressed) { if (Input.mbLeft.pressed) { Vector2 g = customGrid(); p1 = (Vector2.Transform(Input.mbPos, Matrix.Invert(viewTransform())) / g).RoundVector() * g; rect.pos = p1; rect.size = Vector2.Zero; isPosSet = true; } else if (isPosSet) { if (Input.mbLeft.down) { Vector2 g = customGrid(); Vector2 p2 = (Vector2.Transform(Input.mbPos, Matrix.Invert(viewTransform())) / g).RoundVector() * g; if (positiveSize) { rect.size = (p2 - p1).AbsVector(); rect.pos = Calculate.MinVector(p1, p2); } else { rect.size = p2 - p1; } txt.text = MyConverter.ToString(rect); } else if (Input.mbLeft.released) { btn.pressed = false; isPosSet = false; SetCatchUpdate(null); if (ValueChanged != null) { ValueChanged(rect); } } } } else { txt.Update(); isPosSet = false; } } }
public override void Update() { if (visible) { UpdateBegin(); btn.Update(); txt.Update(); } }