Exemplo n.º 1
0
        internal static ImmutableCircle_double MakeCircle(this IBiaNodeItem self)
        {
            var size = self.Size;

            return(new ImmutableCircle_double(
                       self.Pos.X + size.Width * 0.5,
                       self.Pos.Y + size.Height * 0.5,
                       size.Width * 0.5));
        }
Exemplo n.º 2
0
        internal static double MakeSlotMarkRadiusSq(this FrameworkElement self, IBiaNodeItem nodeItem)
        {
            var slotMarkRadiusSq = Constants.SlotMarkRadiusSq(nodeItem.Flags.HasFlag(BiaNodePaneFlags.DesktopSpace));

            if (nodeItem.Flags.HasFlag(BiaNodePaneFlags.DesktopSpace))
            {
                var invScale = 1d / self.CalcCompositeRenderScale();
                slotMarkRadiusSq *= invScale * invScale;
            }

            return(slotMarkRadiusSq);
        }
Exemplo n.º 3
0
        internal static InternalBiaNodeItemData InternalData(this IBiaNodeItem self)
        {
            InternalBiaNodeItemData internalData;

            if (self.InternalData is null)
            {
                internalData      = new InternalBiaNodeItemData();
                self.InternalData = internalData;
            }
            else
            {
                internalData = (InternalBiaNodeItemData)self.InternalData;
            }

            return(internalData);
        }
Exemplo n.º 4
0
        internal static ImmutableVec2_double MakeSlotPosDefault(this IBiaNodeItem nodeItem, BiaNodeSlot slot)
        {
            Debug.Assert(slot != null);

            if (nodeItem.MakeSlotPos != null)
            {
                var p = nodeItem.MakeSlotPos(slot);
                return(Unsafe.As <Point, ImmutableVec2_double>(ref p));
            }

            var itemSize = nodeItem.Size;
            var itemPos  = nodeItem.AlignPos();

            var slotLocalPos = slot.MakePos(itemSize.Width, itemSize.Height);

            return(new ImmutableVec2_double(itemPos.X + slotLocalPos.X, itemPos.Y + slotLocalPos.Y));
        }
Exemplo n.º 5
0
 internal static bool HitCheck(
     this BiaNodeSlot slot,
     double invScale, IBiaNodeItem nodeItem,
     in ImmutableVec2_double slotPos, in ImmutableVec2_double mousePos)
Exemplo n.º 6
0
 public BiaNodeItemSlotPair(IBiaNodeItem item, BiaNodeSlot slot)
 {
     Item = item;
     Slot = slot;
 }
Exemplo n.º 7
0
 internal static BiaNodeSlot?FindSlotFromPos(
     this IBiaNodeItem nodeItem, in ImmutableVec2_double pos, FrameworkElement control)
Exemplo n.º 8
0
 internal static ImmutableRect_double MakeRect(this IBiaNodeItem self)
 => new ImmutableRect_double(self.Pos, self.Size);
Exemplo n.º 9
0
 internal static BiaNodeSlot?FindSlotFromPos(this IBiaNodeItem nodeItem, in ImmutableVec2_double pos)