private void setupFacetFromFile(FacetPanel facetPane) { var points = load2DPointsFromFile(); facetPane.ClearParts(); facetPane.AddPart(new EditorShapePart(points)); refreshEditorInputs(); }
internal void FitSize(FacetPanel bindedPanel) { var maxOffsetX = Math.Max(Math.Abs(MetricShiftX), Math.Abs(bindedPanel.MetricShiftX)); var maxOffsetY = Math.Max(Math.Abs(MetricShiftY), Math.Abs(bindedPanel.MetricShiftY)); var maxWidth = Math.Max(MetricWidth + maxOffsetX, bindedPanel.MetricWidth + maxOffsetX); var maxHeight = Math.Max(MetricHeight + maxOffsetY, bindedPanel.MetricHeight + maxOffsetY); var availableWidth = ActualWidth - 20; var availableHeight = ActualHeight - 20; var sizeFactor = Math.Min(availableWidth / maxWidth, availableHeight / maxHeight); VisualScale = sizeFactor; VisualOffsetX = 10 + Math.Max(0, -Math.Min(MetricShiftX, bindedPanel.MetricShiftX)) * VisualScale; //VisualOffsetX = -Math.Min(_shapeMinC1, bindedPanel._shapeMinC1) * getMetricScale() * VisualScale - availableWidth / 2; //VisualOffsetY = -Math.Min(_shapeMinC2, bindedPanel._shapeMinC2) * getMetricScale() * VisualScale - availableHeight / 2; bindedPanel.VisualOffsetX = VisualOffsetX; bindedPanel.VisualOffsetY = VisualOffsetY; bindedPanel.VisualScale = sizeFactor; }