Equals() public method

public Equals ( Rect value ) : bool
value Rect
return bool
Example #1
0
 protected virtual bool DoesntContain(Rect rect, double otherStart, double otherEnd)
 {
     if (rect.Equals(Rect.Empty)) return true;
     double center = (otherStart + otherEnd)/2;
     if (center.IsInvalid()) return true;
     return center < start || center > end;
 }
Example #2
0
		internal void AnimateActiveAreaRectTo(Rect newRect)
		{
			if (newRect.Equals(currentAnimateActiveAreaRectToTarget))
				return;
			activeAreaGeometry.BeginAnimation(
				RectangleGeometry.RectProperty,
				new RectAnimation(newRect, new Duration(new TimeSpan(0,0,0,0,100))),
				HandoffBehavior.SnapshotAndReplace);
			currentAnimateActiveAreaRectToTarget = newRect;
		}
Example #3
0
        /// <summary>
        /// Equals - compares this Rect with the passed in object.  In this equality
        /// Double.NaN is equal to itself, unlike in numeric equality.
        /// Note that double values can acquire error when operated upon, such that
        /// an exact comparison between two values which
        /// are logically equal may fail.
        /// </summary>
        /// <returns>
        /// bool - true if the object is an instance of Rect and if it's equal to "this".
        /// </returns>
        /// <param name='o'>The object to compare to "this"</param>
        public override bool Equals(object o)
        {
            if ((null == o) || !(o is Rect))
            {
                return(false);
            }

            Rect value = (Rect)o;

            return(Rect.Equals(this, value));
        }
Example #4
0
 /// <summary>
 /// Equals - compares this Rect with the passed in object.  In this equality
 /// Double.NaN is equal to itself, unlike in numeric equality.
 /// Note that double values can acquire error when operated upon, such that
 /// an exact comparison between two values which
 /// are logically equal may fail.
 /// </summary>
 /// <returns>
 /// bool - true if "value" is equal to "this".
 /// </returns>
 /// <param name='value'>The Rect to compare to "this"</param>
 public bool Equals(Rect value)
 {
     return(Rect.Equals(this, value));
 }
		public void Equals ()
		{
			Rect r1 = new Rect (1, 2, 3, 4);
			Rect r2 = r1;

			Assert.IsTrue (r1.Equals (r1));

			r2.X = 0;
			Assert.IsFalse (r1.Equals (r2));
			r2.X = r1.X;

			r2.Y = 0;
			Assert.IsFalse (r1.Equals (r2));
			r2.Y = r1.Y;

			r2.Width = 0;
			Assert.IsFalse (r1.Equals (r2));
			r2.Width = r1.Width;

			r2.Height = 0;
			Assert.IsFalse (r1.Equals (r2));
			r2.Height = r1.Height;

			Assert.IsFalse (r1.Equals (new object ()));

			r1 = Rect.Empty;
			r2 = Rect.Empty;

			Assert.AreEqual (true, r1.Equals (r2));
			Assert.AreEqual (true, r2.Equals (r1));
		}
Example #6
0
 public static bool Equals(Rect rect1, Rect rect2)
 {
     return(rect1.Equals(rect2));
 }
 public static bool Equals(Rect rect1, Rect rect2)
 {
     return rect1.Equals (rect2);
 }
Example #8
0
        private void ShowPopup(PopupData popupData, UIElement element, Rect startRect, Rect endRect, double startOpacity, double endOpacity, double animationDuration, Action onClosed, IEnumerable<AnimationInfo> animations = null)
        {
            if (popupData.Element != null)
            ClosePopup(popupData, popupData.Element, true);

              var sizedElement = new SizedElement(element, new Size(startRect.Width, startRect.Height)) { Opacity = startOpacity };
              Popup popup = popupData.Popup;
              popup.Child = sizedElement;
              popup.HorizontalOffset = startRect.X;
              popup.VerticalOffset = startRect.Y;
              popup.Width = startRect.Width;
              popup.Height = startRect.Height;
              popupData.Element = element;
              popupData.OnPopupClosed = onClosed;
              popup.IsOpen = true;
              popupData.InitialBackgroundState = myCurrentBackgroundState;

              if (!endRect.Equals(startRect))
              {
            var xAnimation = new AnimationInfo(popup, new PropertyPath(Popup.HorizontalOffsetProperty), startRect.X, endRect.X);
            var yAnimation = new AnimationInfo(popup, new PropertyPath(Popup.VerticalOffsetProperty), startRect.Y, endRect.Y);
            var widthAnimation = new AnimationInfo(sizedElement, new PropertyPath(SizedElement.WidthProperty), startRect.Width, endRect.Width);
            var heightAnimation = new AnimationInfo(sizedElement, new PropertyPath(SizedElement.HeightProperty), startRect.Height, endRect.Height);
            var additionalAnimations = new[] {xAnimation, yAnimation, widthAnimation, heightAnimation};
            animations = animations != null ? animations.Concat(additionalAnimations) : additionalAnimations;
              }

              popupData.AnimationsOnClose = animations != null ? (ICollection<AnimationInfo>)animations.Select(info => info.Reverse()).ToList() : new AnimationInfo[0];

              AnimatePopup(sizedElement, animationDuration, endOpacity, Math.Min(myCurrentBackgroundState.Opacity, 0.7), 5, animations);
        }
 /// <summary>
 /// Writes the attribute.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="value">The value.</param>
 /// <param name="defaultValue">The default value.</param>
 protected void WriteAttribute(string name, Rect value, Rect defaultValue)
 {
     if (this.settings.WriteDefaultValues || !value.Equals(defaultValue)) {
         this.writer.WriteAttributeString(name, value.Format());
     }
 }
Example #10
0
		public void EqualsNaN ()
		{
			Rect r = new Rect (Double.NaN, Double.NaN, Double.NaN, Double.NaN);
			Assert.IsFalse (r.Equals (r), "Equals(Rect)");
			Assert.IsFalse (r.Equals ((object)r), "Equals(object)");
		}