コード例 #1
0
ファイル: MarkerNode.cs プロジェクト: yazici/Atlas-Chart-PCG
 /// <summary>
 /// Will consume the event and declare the GUI changed. Uses given delta instead of the event's.
 /// </summary>
 public void UpdateDrag(Event e, Rect rect, Vector2 delta, SnapSetting snapSetting)
 {
     if (dragHandler.IsDragging(e, rect))
     {
         e.Use();
         rawPosition    += delta;
         marker.Position = Round(rawPosition, snapSetting);
         GUI.changed     = true;
     }
 }
コード例 #2
0
        void HandleDrag()
        {
            Event   e           = Event.current;
            Rect    textureArea = GetTextureArea();
            Vector2 delta       = new Vector2(e.delta.x, -e.delta.y) / scale;

            foreach (MarkerNode marker in ((IEnumerable <MarkerNode>)markers).Reverse())
            {
                Rect markerRect = GetMarkerRect(marker);
                markerRect.x += textureArea.x;
                marker.UpdateDrag(e, markerRect, delta);
            }
            if (dragHandler.IsDragging(e, textureArea))
            {
                dragTotal  += e.delta;
                GUI.changed = true;
                e.Use();
            }
        }