예제 #1
0
    /// <summary>
    /// Called at the start of the program.
    /// </summary>
    ///
    void Start()
    {
        // take care of inputs
        actionPaint  = InputHandler.Find(actionNamePaint);
        actionUndo   = InputHandler.Find(actionNameUndo);
        actionColour = InputHandler.Find(actionNameBrushColour);
        actionSize   = InputHandler.Find(actionNameBrushSize);
        actionSave   = InputHandler.Find(actionNameSave);
        actionReset  = InputHandler.Find(actionNameReset);

        // generate basic objects
        if (brushObject == null)
        {
            brushObject = transform.Find("Brush");
        }
        trailRenderer = GetComponentInChildren <TrailRenderer>();
        sizeFactor    = 0;
        strokeIndex   = 1;

        activeStroke         = null;
        strokeMaterials      = null;
        strokeMaterialIndex  = 1;
        strokeIndicatorTimer = 0;

        strokeList      = new StrokeList();
        strokeContainer = new GameObject("Strokes").transform;
    }
예제 #2
0
        public void Duplicate()
        {
            if (SelectedStrokesIds.Count > 0)
            {
                Clipboard = new StrokeList(SelectedStrokes);
            }

            if (Clipboard == null)
            {
                return;
            }

            SelectionChanged?.Invoke(new StrokeList());

            var copiedStrokes     = new StrokeList();
            var translationMatrix = Constants.DuplicationTransform;
            var offset            = 0;

            foreach (var s in Clipboard.OrderBy(x => (x as StrokeModel)?.CreatedDate))
            {
                var strokeModel = new StrokeModel(s.Clone(), UserId);
                strokeModel.CreatedDate = strokeModel.CreatedDate.AddMilliseconds(offset++);
                strokeModel.Transform(translationMatrix, false);
                copiedStrokes.Add(strokeModel);
            }

            Strokes.Add(new StrokeCollection(copiedStrokes));
            SelectionChanged?.Invoke(copiedStrokes);
            EditingMode = InkCanvasEditingMode.Select;
        }
예제 #3
0
 /// <summary>
 /// Called at the start of the program.
 /// </summary>
 ///
 public void Start()
 {
     strokeList   = new StrokeList();
     strokeIndex  = 0;
     state        = State.Standby;
     loaderThread = null;
     lastLog      = "";
 }
예제 #4
0
 public void Cut()
 {
     if (SelectedStrokesIds.Count == 0)
     {
         return;
     }
     Clipboard = new StrokeList(SelectedStrokes);
     Clipboard.ForEach(x => Strokes.Remove(x));
     SelectedStrokesIds.Clear();
     EditingMode = InkCanvasEditingMode.Select;
 }