5 namespace droid.Runtime.Utilities.Misc.Drawing {
6 public static partial class NeodroidDrawingUtilities {
14 public static void DrawString(
string text,
21 var restore_color = GUI.color;
24 GUI.color = color.Value;
27 var view = SceneView.currentDrawingSceneView;
28 var screen_pos = view.camera.WorldToScreenPoint(world_pos);
31 || screen_pos.y > Screen.height
33 || screen_pos.x > Screen.width
34 || screen_pos.z < 0) {
35 GUI.color = restore_color;
40 Handles.Label(TransformByPixel(world_pos, o_x, o_y), text);
42 GUI.color = restore_color;
52 public static Vector3 TransformByPixel(Vector3 position,
float x,
float y) {
53 return TransformByPixel(position,
new Vector3(x, y));
61 public static Vector3 TransformByPixel(Vector3 position, Vector3 translate_by) {
62 var cam = SceneView.currentDrawingSceneView.camera;
63 return cam ? cam.ScreenToWorldPoint(cam.WorldToScreenPoint(position) + translate_by) : position;