public IconCanvasGuide(IconCanvas canvas, Vector2 normalizedPos, IconCanvasGuideType type) { this.canvas = canvas; this.type = type; SetLocalPosition(normalizedPos); Guides.Add(this); }
void OnEnable() { wantsMouseMove = true; wantsMouseEnterLeaveWindow = true; Prefs.DrawRulers.valueChanged.AddListener(Repaint); if (!canvas) { canvas = CreateInstance(typeof(IconCanvas)) as IconCanvas; canvas.Size.valueChanged.AddListener(Repaint); } canvas.Reset(); IconCanvasGuide.ClearAllGuides(); }
void OnDisable() { DestroyImmediate(canvas); canvas = null; }
/// <summary> /// Add a guide to the screen /// </summary> /// <param name="bounds">The area we are allowed to draw in</param> /// <param name="canvas">The area that will be used for positioning</param> /// <param name="normalizedPos">The position (local to <paramref name="canvas"/>) that the guide will be placed</param> /// <param name="type">Horizontal or vertical</param> public IconCanvasGuide(IconCanvas canvas, float normalizedPos, IconCanvasGuideType type) : this(canvas, new Vector2(normalizedPos, normalizedPos), type) { }