public R3ePoint GetValidPosition(PlaceholderModel placeholder, R3ePoint wantedPosition) { double validX = wantedPosition.X; double validY = wantedPosition.Y; int xMin = screenModel.Layout == ScreenLayoutType.SINGLE ? -1 : -3; int xMax = screenModel.Layout == ScreenLayoutType.SINGLE ? 1 : 3; int yMin = -1; int yMax = 1; // No check if placeholder is already outside the screen (case: we were in triple screen and switch to a single screen background, and at prompt we choose NOT to move placeholders in center screen. if (wantedPosition.X < xMin && placeholder.Position.X >= xMin) { validX = xMin; } else if (wantedPosition.X > xMax && placeholder.Position.X <= xMax) { validX = xMax; } if (wantedPosition.Y < yMin && placeholder.Position.Y >= yMin) { validY = yMin; } else if (wantedPosition.Y > yMax && placeholder.Position.Y <= yMax) { validY = yMax; } return(new R3ePoint(validX, validY)); }
public PlaceholderGeom(R3ePoint position, R3ePoint anchor, R3ePoint size, Size bitmapSize) { Position = position; Anchor = anchor; Size = size; BitmapSize = bitmapSize; }
public static string GetPresetName(R3ePoint point) { foreach (KeyValuePair <string, R3ePoint> entry in presets) { if (entry.Value.Equals(point)) { return(entry.Key); } } return(null); }
public static string GetPresetName(R3ePoint point, ScreenPositionType screenType) { if (screenType == ScreenPositionType.LEFT) { point = new R3ePoint(point.X + 2, point.Y); } else if (screenType == ScreenPositionType.RIGHT) { point = new R3ePoint(point.X - 2, point.Y); } return(GetPresetName(point)); }
private void OnAnchorPresetSelected(object sender, SelectionChangedEventArgs e) { if (holdPresetEvent) { return; } string name = anchorPresets.SelectedItem.ToString(); R3ePoint anchor = R3ePointPreset.GetPreset(name); if (anchor != null) { DispatchEvent(new SelectionViewEventArgs(EVENT_ANCHOR_MOVED, anchor)); } }
public static R3ePoint GetPreset(string name, ScreenPositionType screenType) { R3ePoint preset = presets[name].Clone(); switch (screenType) { case ScreenPositionType.LEFT: return(new R3ePoint(preset.X - 2, preset.Y)); case ScreenPositionType.RIGHT: return(new R3ePoint(preset.X + 2, preset.Y)); } return(preset); }
private void OnPositionPresetSelected(object sender, SelectionChangedEventArgs e) { if (holdPresetEvent) { return; } string name = positionPresets.SelectedItem.ToString(); R3ePoint position = isTripleScreen ? R3ePointPreset.GetPreset(name, ScreenUtils.GetScreen(Selection)) : R3ePointPreset.GetPreset(name); DispatchEvent(new SelectionViewEventArgs(EVENT_PLACEHOLDER_MOVED, position)); if (linkAnchorsCheck.IsChecked == true) { anchorPresets.SelectedItem = position; DispatchEvent(new SelectionViewEventArgs(EVENT_ANCHOR_MOVED, R3ePointPreset.GetPreset(name))); } }
public void Execute() { if (screenModel.Layout != ScreenLayoutType.TRIPLE) { return; } PlaceholderModel placeholder = collectionModel.Get(args.PlaceholderId); ScreenPositionType currentScreen = ScreenUtils.GetScreen(placeholder); R3ePoint screenOffset = ScreenUtils.ToScreenOffset(placeholder, args.ScreenType); R3ePoint newPosition = new R3ePoint(placeholder.Position.X + screenOffset.X, placeholder.Position.Y + screenOffset.Y); if (!newPosition.Equals(placeholder.Position)) { placeholder.Move(newPosition); } }
public Size GetSize(R3ePoint modelSize, Size referenceScreenSize, Size targetScreenSize, Size placeholderReferenceSize, bool isTripleScreen) { if (isTripleScreen) { targetScreenSize = new Size(targetScreenSize.Width / 3, targetScreenSize.Height); } else { targetScreenSize = new Size(targetScreenSize.Width, targetScreenSize.Height); } double factor = Math.Sqrt(targetScreenSize.Width * targetScreenSize.Height) / Math.Sqrt(referenceScreenSize.Width * referenceScreenSize.Height); return(new Size( modelSize.X * factor * placeholderReferenceSize.Width, modelSize.Y * factor * placeholderReferenceSize.Height )); }
private R3ePoint GetR3eLocation(Point location) { Size objectScreenRatio = new Size(args.View.ContentBounds.Width / screenView.ScreenArea.Width, args.View.ContentBounds.Height / screenView.ScreenArea.Height); R3ePoint anchorSize = new R3ePoint( objectScreenRatio.Width * (args.View.Model.Anchor.X + 1), objectScreenRatio.Height * (args.View.Model.Anchor.Y - 1)); Point position = new Point(location.X - screenView.ScreenArea.X, location.Y - screenView.ScreenArea.Y); R3ePoint r3ePosition = Coordinates.ToR3e(position, screenView.ScreenArea.Size); r3ePosition = new R3ePoint(r3ePosition.X + anchorSize.X, r3ePosition.Y + anchorSize.Y); if (screenModel.Layout == ScreenLayoutType.TRIPLE) { return(new R3ePoint(r3ePosition.X * 3, r3ePosition.Y)); } else { return(r3ePosition); } }
private string GetVector(R3ePoint point) { return($"{{{point.X.ToString(CultureInfo.InvariantCulture)} {point.Y.ToString(CultureInfo.InvariantCulture)}}}"); }
public void Resize(R3ePoint position) { Size = position; DispatchEvent(new PlaceHolderUpdatedEventArgs(EVENT_UPDATED, this)); SetValidationResult(layoutValidator.Matches(this)); }
public void Resize(R3ePoint size) { Size = size; }
public void MoveAnchor(R3ePoint position) { Anchor = position; }
public void Move(R3ePoint position) { Position = position; }
public SelectionViewEventArgs(int eventId, R3ePoint point) : base(eventId) { Point = point; }