Пример #1
0
 internal void anchorableDoneMoving(Anchorable anchorable)
 {
     if (((CustomStroke)anchorable).Id.ToString() == this.FirstAnchorId || ((CustomStroke)anchorable).Id.ToString() == this.SecondAncorId)
     {
         EditionSocket.EditStroke(this.toJson());
     }
 }
Пример #2
0
        public void SetText(string text)
        {
            string before = this.toJson();

            this.Name = text;
            this.Refresh();
            EditionSocket.EditStroke(this.toJson());
            Editeur.instance.Do(new EditStroke(this.Id.ToString(), before, this.toJson()));
        }
Пример #3
0
        internal void setSecondRelation(Relation value)
        {
            string before = this.toJson();

            this.SecondRelation = value;
            this.Refresh();
            EditionSocket.EditStroke(this.toJson());
            Editeur.instance.Do(new EditStroke(this.Id.ToString(), before, this.toJson()));
        }
Пример #4
0
        internal void setFirstLabel(string value)
        {
            string before = this.toJson();

            this.FirstText = value;
            this.Refresh();
            EditionSocket.EditStroke(this.toJson());
            Editeur.instance.Do(new EditStroke(this.Id.ToString(), before, this.toJson()));
        }
Пример #5
0
        public void SetText(string text)
        {
            string before = this.toJson();

            this.textContent = text.Split(new[] { "\r\n" }, StringSplitOptions.None).ToList();
            this.Refresh();
            EditionSocket.EditStroke(this.toJson());
            Editeur.instance.Do(new EditStroke(this.Id.ToString(), before, this.toJson()));
        }
Пример #6
0
        public override void Undo(CustomStrokeCollection strokes)
        {
            if (strokes.has(Id))
            {
                CustomStroke old = strokes.get(Id);
                if (old.isLocked())
                {
                    throw new Exception("Stroke is Locked");
                }

                EditionSocket.EditStroke(SerializedStrokeBefore);

                CustomStroke updated  = SerializationHelper.stringToStroke(JObject.Parse(SerializedStrokeBefore), strokes);
                bool         selected = ((CustomStroke)old).isSelected();
                bool         editting = ((CustomStroke)old).isEditing();
                ((CustomStroke)old).stopEditing();
                strokes.Remove(strokes.get(Id));

                int newindex = strokes.ToList().FindIndex(stroke => ((CustomStroke)stroke).Index > updated.Index);

                try
                {
                    strokes.Insert(newindex, updated);
                }
                catch
                {
                    strokes.Add(updated);
                }

                if (selected)
                {
                    strokes.get(updated.Id.ToString()).Select();
                }
                if (editting)
                {
                    strokes.get(updated.Id.ToString()).startEditing();
                }

                if (updated is Anchorable)
                {
                    strokes.ToList().FindAll(stroke => stroke is BaseLine).ForEach(stroke => ((BaseLine)stroke).anchorableMoved((Anchorable)updated));
                }
            }
        }
Пример #7
0
        public void HandleStoped(Guid id)
        {
            int movedIndex = this.HandlePoints.FindIndex(i => i.ToString() == id.ToString());

            if (!(movedIndex == 0 || movedIndex == this.HandlePoints.Count - 1))
            {
                if (10 > this.FindDistanceToSegment(this.StylusPoints[movedIndex].ToPoint(), this.StylusPoints[movedIndex - 1].ToPoint(), this.StylusPoints[movedIndex + 1].ToPoint()))
                {
                    this.deleteDragHandles();
                    this.HandlePoints.RemoveAt(movedIndex);
                    this.StylusPoints.RemoveAt(movedIndex);
                    this.Refresh();
                }
            }

            EditionSocket.EditStroke(this.toJson());
            Editeur.instance.Do(new EditStroke(this.Id.ToString(), beforeMove, this.toJson()));
            this.beforeMove = null;
        }