コード例 #1
0
ファイル: Extents.cs プロジェクト: AdilGM/2DCAD
 public MarkGeometryPoint GetClosestOrigin()
 {
     return(new MarkGeometryPoint(
                GeometricArithmeticModule.Constrain(0, (double)(MinX as double?), (double)(MaxX as double?)),
                GeometricArithmeticModule.Constrain(0, (double)(MinY as double?), (double)(MaxY as double?)),
                GeometricArithmeticModule.Constrain(0, (double)(MinZ as double?), (double)(MaxZ as double?))
                ));
 }
コード例 #2
0
        public virtual void Zoom(double delta = 0)
        {
            //changed minRange constrain to 1 instead of 0.001
            //to limit zoom out
            double tmpZoom = _zoom;

            _zoom = GeometricArithmeticModule.Constrain(
                _zoom + ((delta > 0 ? _zoomFactor : -_zoomFactor) * _trueScale),
                1,
                1000
                );

            double dZoom = _zoom - tmpZoom;

            _panOffset.X -= (Mouse.X + _cadOffset.X) * _scale * dZoom;
            _panOffset.Y -= (Mouse.Y + _cadOffset.Y) * _scale * dZoom;

            Render();
        }