Esempio n. 1
0
 public MeTLImage Clone()
 {
     var img = new MeTLImage();
     img.Height = Height;
     img.Width = Width;
     img.Source = Source;
     InkCanvas.SetLeft(img, InkCanvas.GetLeft(this));
     InkCanvas.SetTop(img, InkCanvas.GetTop(this));
     Canvas.SetZIndex(img, Canvas.GetZIndex(this));
     img.Stretch = Stretch.Fill;
     img.tag(this.tag());
     img.offsetX = offsetX;
     img.offsetY = offsetY;
     return img;
 }
 protected override void ChangeImagePrivacy(MeTLImage image, Privacy newPrivacy)
 {
     image.ApplyPrivacyStyling(ContentBuffer, Target, newPrivacy);
 }
 protected override void RemoveImage(MeTLImage image) 
 { 
     ContentBuffer.RemoveImage(image, (img) => Canvas.Children.Remove(img));
 }
 protected abstract void ChangeImagePrivacy(MeTLImage image, Privacy newPrivacy);
 protected abstract void RemoveImage(MeTLImage image);
 private bool dirtiesThis(TargettedMoveDelta moveDelta, MeTLImage elem)
 {
     return moveDelta.imageIds.Any(i => elem.tag().id == i && elem.tag().privacy == moveDelta.privacy && elem.tag().timestamp < moveDelta.timestamp);
 }
 protected override void RemoveImage(MeTLImage image)
 {
     Canvas.Children.Remove(image);
 }
 private MeTLImage reassociateImageToCanvas(MeTLImage image)
 {
     var diffX = logicalX - image.offsetX;
     var diffY = logicalY - image.offsetY;
     if (diffX != 0 || diffY != 0)
     {
         InkCanvas.SetLeft(image, InkCanvas.GetLeft(image) - diffX);
         InkCanvas.SetTop(image, InkCanvas.GetTop(image) - diffY);
         image.offsetX = logicalX;
         image.offsetY = logicalY;
     }
     return image;
 }
 private MeTLImage doAdjustImage(MeTLImage image, Func<MeTLImage, MeTLImage> adjustment)
 {
     return adjustment(image);
 }
Esempio n. 10
0
        public MeTLImage adjustImage(MeTLImage image, Func<MeTLImage, MeTLImage> adjustment)
        {
            reassociateImageToCanvas(image);
            var oldCanvasOffsetX = logicalX;
            var oldCanvasOffsetY = logicalY;
            double translateX = 0.0;
            double translateY = 0.0;
            var localX = InkCanvas.GetLeft(image);
            var localY = InkCanvas.GetTop(image);
            if (checkIfLogicalBoundsUpdates(localX, localY))
            {
                var newBounds = generateLogicalBounds(localX, localY);
                logicalX = newBounds.X;
                logicalY = newBounds.Y;
                translateX = ReturnPositiveValue(ReturnPositiveValue(logicalX) - ReturnPositiveValue(oldCanvasOffsetX));
                translateY = ReturnPositiveValue(ReturnPositiveValue(logicalY) - ReturnPositiveValue(oldCanvasOffsetY));

                updateCanvasPositioning(strokeFilter.Strokes, textFilter.TextBoxes,
                    imageFilter.Images.Where(i => ((MeTLImage)(i)).tag().id != image.tag().id).Select(i => (UIElement)i), translateX, translateY);
                reassociateImageToCanvas(image);
            }
            return doAdjustImage(image, adjustment);
        }