public void SetHueBaseValue(double hueBaseValue, bool silentSet) { var diff = hueBaseValue - _hueOfButtons[0]; for (int i = 0; i < _hueOfButtons.Length; ++i) { _hueOfButtons[i] = BringInbetween0To1(_hueOfButtons[i] + diff); } SetButtonPositions(); if (!silentSet) { HueValuesChanged?.Invoke(_hueOfButtons); } }
private void EhRectangle_MouseMove(object sender, MouseEventArgs e) { if (_indexOfDraggedButton.HasValue) { // calculate a new phi var position = e.GetPosition(_guiCanvas); position.X -= 0.5 * _guiCanvas.ActualWidth; position.Y -= 0.5 * _guiCanvas.ActualHeight; var phi = Math.Atan2(position.Y, position.X) / (2 * Math.PI); _colorCircleModel.TrySetHueOfButton(_indexOfDraggedButton.Value, phi, _hueOfButtons); SetButtonPositions(); HueValuesChanged?.Invoke(_hueOfButtons); } }
private void EhColorCircleSurface_HueValuesChanged(IReadOnlyList <double> hueValues) { HueValuesChanged?.Invoke(hueValues); }