Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

points text required to optional #1209

Merged
merged 1 commit into from
Jan 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/labels/label.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Label {
float buffer = 0.f;
size_t paramHash = 0; // the label hash based on its styling parameters
LabelProperty::Anchors anchors;
bool required = true;
bool optional = false;
bool flat = false;
float angle = 0.f;
uint32_t featureId = 0;
Expand Down
2 changes: 1 addition & 1 deletion core/src/labels/labelCollider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void LabelCollider::process(TileID _tileID, float _tileInverseScale, float _tile
// First check if the child is required is occluded
if (label->parent()->isOccluded()) {
label->occlude();
} else if (label->options().required && label->isOccluded()) {
} else if (!label->options().optional && label->isOccluded()) {
label->parent()->occlude();
label->parent()->enterState(Label::State::dead, 0.0f);
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/labels/labels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ void Labels::handleOcclusions(const ViewState& _viewState) {
} while (l->isOccluded() && l->nextAnchor());

// At this point, the label has a parent that is visible,
// if it is a required label, turn the parent to occluded
// if it is not an optional label, turn the parent to occluded
if (l->isOccluded()) {
if (l->parent() && l->options().required) {
if (l->parent() && !l->options().optional) {
l->parent()->occlude();
}
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/scene/styleParam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const std::map<std::string, StyleParamKey> s_StyleParamMap = {
{"text:priority", StyleParamKey::text_priority},
{"text:repeat_distance", StyleParamKey::text_repeat_distance},
{"text:repeat_group", StyleParamKey::text_repeat_group},
{"text:required", StyleParamKey::text_required},
{"text:optional", StyleParamKey::text_optional},
{"text:text_source", StyleParamKey::text_source},
{"text:text_wrap", StyleParamKey::text_wrap},
{"text:transition:hide:time", StyleParamKey::text_transition_hide_time},
Expand Down Expand Up @@ -242,7 +242,7 @@ StyleParam::Value StyleParam::parseString(StyleParamKey key, const std::string&
case StyleParamKey::text_visible:
case StyleParamKey::outline_visible:
case StyleParamKey::collide:
case StyleParamKey::text_required:
case StyleParamKey::text_optional:
case StyleParamKey::text_collide:
if (_value == "true") { return true; }
if (_value == "false") { return false; }
Expand Down Expand Up @@ -381,7 +381,7 @@ std::string StyleParam::toString() const {
case StyleParamKey::outline_visible:
case StyleParamKey::centroid:
case StyleParamKey::collide:
case StyleParamKey::text_required:
case StyleParamKey::text_optional:
case StyleParamKey::text_collide:
if (!value.is<bool>()) break;
return k + std::to_string(value.get<bool>());
Expand Down
2 changes: 1 addition & 1 deletion core/src/scene/styleParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ enum class StyleParamKey : uint8_t {
transition_hide_time,
transition_selected_time,
transition_show_time,
text_required,
text_optional,
text_transition_hide_time,
text_transition_selected_time,
text_transition_show_time,
Expand Down
2 changes: 1 addition & 1 deletion core/src/style/textStyleBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ TextStyle::Parameters TextStyleBuilder::applyRule(const DrawRule& _rule,
}
}

_rule.get(StyleParamKey::text_required, p.labelOptions.required);
_rule.get(StyleParamKey::text_optional, p.labelOptions.optional);

// TODO style option?
p.labelOptions.buffer = p.fontSize * 0.25f;
Expand Down
3 changes: 0 additions & 3 deletions scenes/scene.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ layers:
collide: true
transition: { show: { time: 0s }, hide: { time: 1s } }
text:
required: true
interactive: true
font:
family: Open Sans
Expand Down Expand Up @@ -470,7 +469,6 @@ layers:
interactive: true
priority: 6
text:
required: false
visible: false

# add text label at higher zoom
Expand All @@ -481,7 +479,6 @@ layers:
draw:
icons:
text:
required: true
visible: true
font:
size: 12px
Expand Down