IsZero() public static method

IsZero - Returns whether or not the double is "close" to 0. Same as AreClose(double, 0), but this is faster.
public static IsZero ( double value ) : bool
value double The double to compare to 0.
return bool
Exemplo n.º 1
0
        // Token: 0x0600650D RID: 25869 RVA: 0x001C5B40 File Offset: 0x001C3D40
        private static bool DumpFlowDocumentView(XmlTextWriter writer, UIElement element, bool uiElementsOnly)
        {
            FlowDocumentView flowDocumentView = element as FlowDocumentView;
            IScrollInfo      scrollInfo       = flowDocumentView;

            if (scrollInfo.ScrollOwner != null)
            {
                Size size = new Size(scrollInfo.ExtentWidth, scrollInfo.ExtentHeight);
                if (DoubleUtil.AreClose(size, element.DesiredSize))
                {
                    LayoutDump.DumpSize(writer, "Extent", size);
                }
                Point point = new Point(scrollInfo.HorizontalOffset, scrollInfo.VerticalOffset);
                if (!DoubleUtil.IsZero(point.X) || !DoubleUtil.IsZero(point.Y))
                {
                    LayoutDump.DumpPoint(writer, "Offset", point);
                }
            }
            FlowDocumentPage documentPage     = flowDocumentView.Document.BottomlessFormatter.DocumentPage;
            GeneralTransform generalTransform = documentPage.Visual.TransformToAncestor(flowDocumentView);
            Point            point2           = new Point(0.0, 0.0);

            generalTransform.TryTransform(point2, out point2);
            if (!DoubleUtil.IsZero(point2.X) && !DoubleUtil.IsZero(point2.Y))
            {
                LayoutDump.DumpPoint(writer, "PagePosition", point2);
            }
            LayoutDump.DumpFlowDocumentPage(writer, documentPage);
            return(false);
        }
Exemplo n.º 2
0
        // ------------------------------------------------------------------
        // Dump FlowDocumentView specific data.
        // ------------------------------------------------------------------
        private static bool DumpFlowDocumentView(XmlTextWriter writer, UIElement element, bool uiElementsOnly)
        {
            FlowDocumentView fdView = element as FlowDocumentView;

            Debug.Assert(fdView != null, "Dump function has to match element type.");

            // Dump scrolling information
            IScrollInfo isi = (IScrollInfo)fdView;

            if (isi.ScrollOwner != null)
            {
                Size extent = new Size(isi.ExtentWidth, isi.ExtentHeight);
                if (DoubleUtil.AreClose(extent, element.DesiredSize))
                {
                    DumpSize(writer, "Extent", extent);
                }
                Point offset = new Point(isi.HorizontalOffset, isi.VerticalOffset);
                if (!DoubleUtil.IsZero(offset.X) || !DoubleUtil.IsZero(offset.Y))
                {
                    DumpPoint(writer, "Offset", offset);
                }
            }

            FlowDocumentPage documentPage = fdView.Document.BottomlessFormatter.DocumentPage;

            // Dump transform relative to its parent
            GeneralTransform gt    = documentPage.Visual.TransformToAncestor(fdView);
            Point            point = new Point(0, 0);

            gt.TryTransform(point, out point);
            if (!DoubleUtil.IsZero(point.X) && !DoubleUtil.IsZero(point.Y))
            {
                DumpPoint(writer, "PagePosition", point);
            }

            DumpFlowDocumentPage(writer, documentPage);

            return(false);
        }