Exemplo n.º 1
0
        public void SnapToGrid_IntUp_Test()
        {
            int orig     = (int)(Snap.GRID_SIZE * 5.75);
            int expected = Snap.GRID_SIZE * 6;

            Assert.AreEqual(expected, Snap.ToGrid(orig));
        }
Exemplo n.º 2
0
        public void SnapToGrid_DoubleDown_Test()
        {
            double orig     = Snap.GRID_SIZE * 5.05;
            double expected = Snap.GRID_SIZE * 5;

            Assert.AreEqual(expected, Snap.ToGrid(orig), 0.0001);
        }
Exemplo n.º 3
0
        protected override void OnPreviewMouseMove(MouseEventArgs e)
        {
            var newPoint = Snap.ToGrid(e.GetPosition(this));

            if (!DoubleUtils.Equals(newPoint, this.MousePosition))
            {
                this.MousePosition = newPoint;
            }
        }