public static void ReactCentralPartDoubleClick(this PeriodChoiceControlModel model, double x, double controlActualWidth) { if (model.CentralPartDoubleClick) { model.ShrinkAroundX(x, controlActualWidth); } else { model.SetPositions(-4, controlActualWidth); // expand central part all over control } model.CentralPartDoubleClick = !model.CentralPartDoubleClick; }
private static void ShrinkAroundX(this PeriodChoiceControlModel model, double x, double controlActualWidth) { double left = x - PeriodChoiceControlModel.MinCenterPartWidth / 2; if (left < -4) { left = -4; } if (left > controlActualWidth - PeriodChoiceControlModel.MinCenterPartWidth - 4) { left = controlActualWidth - PeriodChoiceControlModel.MinCenterPartWidth - 4; } model.SetPositions(left, PeriodChoiceControlModel.MinCenterPartWidth); }