Skip to content

Commit

Permalink
sccharts.ui: Adjusted defaults for synthesis options
Browse files Browse the repository at this point in the history
Label management and label side
  • Loading branch information
a-sr committed Feb 6, 2024
1 parent 00765a4 commit efe9a2a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ class LabelPlacementSideHook extends SynthesisHook {
/** The sub category for label placement side selection. */
public static final SynthesisOption LABEL_SIDE_CATEGORY = GeneralSynthesisOptions::LAYOUT

private static final String STRATEGY_CONSISTENT = "Consistent side";
private static final String STRATEGY_SMART = "Smart side";
private static final String STRATEGY_DIRECTIONAL = "Direction-dependent side";
private static final String STRATEGY_CONSISTENT = "Always above";
private static final String STRATEGY_SMART = "Smart";
private static final String STRATEGY_DIRECTIONAL = "Direction-dependent";
private static final String STRATEGY_ON_EDGE = "On edge";
private static final String STRATEGY_ON_EDGE_DIRECTIONAL = "On edge (with arrows)"
private static final boolean ON_EDGE_ARROWS = true;

/** The synthesis option to switch between different side selection strategies. */
public static final SynthesisOption LABEL_SIDE_SELECTION_STRATEGY = SynthesisOption.createChoiceOption(
Expand All @@ -64,10 +64,9 @@ class LabelPlacementSideHook extends SynthesisHook {
newLinkedList(
STRATEGY_CONSISTENT,
STRATEGY_SMART,
STRATEGY_DIRECTIONAL,
STRATEGY_ON_EDGE,
STRATEGY_ON_EDGE_DIRECTIONAL),
STRATEGY_CONSISTENT).setCategory(LABEL_SIDE_CATEGORY);
// STRATEGY_DIRECTIONAL,
STRATEGY_ON_EDGE),
STRATEGY_ON_EDGE).setCategory(LABEL_SIDE_CATEGORY);

@Inject
extension TransitionStyles;
Expand All @@ -82,7 +81,7 @@ class LabelPlacementSideHook extends SynthesisHook {
override finish(Scope scope, KNode node) {
// If inline labels are enabled, we need to style them appropriately
val strategy = LABEL_SIDE_SELECTION_STRATEGY.objectValue;
if (strategy != STRATEGY_ON_EDGE && strategy != STRATEGY_ON_EDGE_DIRECTIONAL) {
if (strategy != STRATEGY_ON_EDGE) {
// Next-to-edge strategies don't need any further processing
return;
}
Expand All @@ -102,7 +101,7 @@ class LabelPlacementSideHook extends SynthesisHook {
LinesDecorator.create()
.withColor(foreground))

if (strategy == STRATEGY_ON_EDGE_DIRECTIONAL) {
if (ON_EDGE_ARROWS) {
inlineLabelConfigurator.addDecoratorRenderingProvider(
DirectionalArrowsDecoratorHotFixed.create()
.withColor(foreground))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class LabelShorteningHook extends SynthesisActionHook {
LabelShorteningStrategies.PRIORITIES,
LabelShorteningStrategies.SEMANTIC_SOFT_WRAPPING,
LabelShorteningStrategies.TRUNCATE
), LabelShorteningStrategies.NO).setCategory(LABEL_MANAGEMENT_CATEGORY).
), LabelShorteningStrategies.SEMANTIC_SOFT_WRAPPING).setCategory(LABEL_MANAGEMENT_CATEGORY).
setUpdateAction(LabelShorteningHook.ID) // Register this action as updater
/** The synthesis option for fixed shorten labels value */
public static val SynthesisOption SHORTEN_LABEL_WIDTH = SynthesisOption::createRangeOption(LabelShorteningHook, "Shortening Width",
Expand Down

0 comments on commit efe9a2a

Please sign in to comment.