Skip to content

Commit c5f5fe1

Browse files
committed
Revert "Added custom default for box and rectpacking contentAlignment."
This reverts commit cb59d9e.
1 parent 35f24ab commit c5f5fe1

File tree

5 files changed

+4
-26
lines changed

5 files changed

+4
-26
lines changed

plugins/org.eclipse.elk.alg.rectpacking/src/org/eclipse/elk/alg/rectpacking/RectPackingLayoutProvider.java

-6
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111

1212
import java.util.ArrayList;
1313
import java.util.Collections;
14-
import java.util.EnumSet;
1514
import java.util.List;
16-
import java.util.Set;
1715

1816
import org.eclipse.elk.alg.rectpacking.firstiteration.AreaApproximation;
1917
import org.eclipse.elk.alg.rectpacking.options.RectPackingOptions;
@@ -24,7 +22,6 @@
2422
import org.eclipse.elk.core.AbstractLayoutProvider;
2523
import org.eclipse.elk.core.math.ElkPadding;
2624
import org.eclipse.elk.core.math.KVector;
27-
import org.eclipse.elk.core.options.ContentAlignment;
2825
import org.eclipse.elk.core.util.ElkUtil;
2926
import org.eclipse.elk.core.util.IElkProgressMonitor;
3027
import org.eclipse.elk.graph.ElkNode;
@@ -42,9 +39,6 @@
4239
* </p>
4340
*/
4441
public class RectPackingLayoutProvider extends AbstractLayoutProvider {
45-
46-
public static final Set<ContentAlignment> DEFAULT_ALIGNMENT =
47-
EnumSet.of(ContentAlignment.H_CENTER, ContentAlignment.V_TOP);
4842
/**
4943
* Calculating and applying layout to the model.
5044
*/

plugins/org.eclipse.elk.alg.rectpacking/src/org/eclipse/elk/alg/rectpacking/util/BlockRow.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import java.util.ArrayList;
1313
import java.util.List;
1414

15-
import org.eclipse.elk.alg.rectpacking.RectPackingLayoutProvider;
1615
import org.eclipse.elk.core.math.KVector;
1716
import org.eclipse.elk.core.util.ElkUtil;
1817
import org.eclipse.elk.graph.ElkNode;
@@ -135,8 +134,7 @@ public void expand(final double widthForRow, final double additionalHeightForRow
135134
i++;
136135
double newWidth = rect.getWidth();
137136
double newHeight = rect.getHeight();
138-
ElkUtil.translate(rect, new KVector(newWidth, newHeight), new KVector(oldWidth, oldHeight),
139-
RectPackingLayoutProvider.DEFAULT_ALIGNMENT);
137+
ElkUtil.translate(rect, new KVector(newWidth, newHeight), new KVector(oldWidth, oldHeight));
140138
}
141139
}
142140

plugins/org.eclipse.elk.core/src/org/eclipse/elk/core/Core.melk

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ programmatic option bendPoints: KVectorChain {
171171
advanced option contentAlignment: EnumSet<ContentAlignment> {
172172
label "Content Alignment"
173173
description "Specifies how the content of compound nodes is to be aligned, e.g. top-left."
174-
default = EnumSet.noneOf(ContentAlignment)
174+
default = EnumSet.of(ContentAlignment.H_CENTER, ContentAlignment.V_TOP)
175175
targets parents
176176
legacyIds de.cau.cs.kieler.klay.layered.contentAlignment
177177
}

plugins/org.eclipse.elk.core/src/org/eclipse/elk/core/util/BoxLayoutProvider.java

+1-10
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,16 @@
1313
import java.util.Arrays;
1414
import java.util.Collections;
1515
import java.util.Comparator;
16-
import java.util.EnumSet;
1716
import java.util.LinkedList;
1817
import java.util.List;
1918
import java.util.ListIterator;
2019
import java.util.PriorityQueue;
2120
import java.util.Queue;
22-
import java.util.Set;
2321

2422
import org.eclipse.elk.core.AbstractLayoutProvider;
2523
import org.eclipse.elk.core.math.ElkPadding;
2624
import org.eclipse.elk.core.math.KVector;
2725
import org.eclipse.elk.core.options.BoxLayouterOptions;
28-
import org.eclipse.elk.core.options.ContentAlignment;
2926
import org.eclipse.elk.core.options.CoreOptions;
3027
import org.eclipse.elk.graph.ElkNode;
3128

@@ -55,9 +52,6 @@
5552
*/
5653
public class BoxLayoutProvider extends AbstractLayoutProvider {
5754

58-
public static final Set<ContentAlignment> DEFAULT_ALIGNMENT =
59-
EnumSet.of(ContentAlignment.H_CENTER, ContentAlignment.V_TOP);
60-
6155
/** default value for aspect ratio. */
6256
public static final double DEF_ASPECT_RATIO = 1.3;
6357

@@ -70,8 +64,6 @@ public void layout(final ElkNode layoutNode, final IElkProgressMonitor progressM
7064
boolean expandNodes = layoutNode.getProperty(BoxLayouterOptions.EXPAND_NODES);
7165
boolean interactive = layoutNode.getProperty(BoxLayouterOptions.INTERACTIVE);
7266

73-
// Set custom default for content alignment.
74-
7567
switch (layoutNode.getProperty(BoxLayouterOptions.BOX_PACKING_MODE)) {
7668
case SIMPLE:
7769
placeBoxes(layoutNode, objSpacing, padding, expandNodes, interactive);
@@ -268,8 +260,7 @@ private KVector placeBoxes(final List<ElkNode> sortedBoxes, final double minSpac
268260
double oldWidth = box.getWidth();
269261
box.setWidth(newWidth);
270262
// Content alignment
271-
ElkUtil.translate(box, new KVector(newWidth, newHeight), new KVector(oldWidth, oldHeight),
272-
DEFAULT_ALIGNMENT);
263+
ElkUtil.translate(box, new KVector(newWidth, newHeight), new KVector(oldWidth, oldHeight));
273264
}
274265
xpos += box.getWidth() + minSpacing;
275266
}

plugins/org.eclipse.elk.core/src/org/eclipse/elk/core/util/ElkUtil.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -610,14 +610,9 @@ public static void translate(final ElkEdgeSection section, final double xoffset,
610610
* @param newSize The new size.
611611
* @param oldSize The old size.
612612
*/
613-
public static void translate(final ElkNode parent, final KVector newSize, final KVector oldSize,
614-
final Set<ContentAlignment> defaultAlignment) {
613+
public static void translate(final ElkNode parent, final KVector newSize, final KVector oldSize) {
615614
Set<ContentAlignment> contentAlignment =
616615
parent.getProperty(CoreOptions.CONTENT_ALIGNMENT);
617-
if (defaultAlignment != null && (!parent.hasProperty(CoreOptions.CONTENT_ALIGNMENT)
618-
|| parent.getProperty(CoreOptions.CONTENT_ALIGNMENT).isEmpty())) {
619-
contentAlignment = defaultAlignment;
620-
}
621616
double xTranslate = 0;
622617
double yTranslate = 0;
623618

0 commit comments

Comments
 (0)