private static Control RenderBit(long number, V origin, long bit, long i, long changeNumberEventId) { var shift = Vec(3 * (i % 8), 3 * (i / 8)); var pos = origin.AddVec(shift); var(x, y) = pos; if (bit == 1) { return(ImageButton(pos, DrawFilledCenteredSquare(1), changeNumberEventId, number - CollectionsModule.Power2(i))); } var num = number + CollectionsModule.Power2(i); var clickArea = new ClickArea(Rect(x - 1, y - 1, 3, 3), changeNumberEventId, num); return(new Control(List(clickArea), List(List(pos)))); }
public static ClickArea ShiftArea(this ClickArea area, V delta) { area.Rect = area.Rect.ShiftRect(delta); return(area); }