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

fix: break word for case of long layer title #1704

Merged
merged 2 commits into from
Mar 6, 2023
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
4 changes: 4 additions & 0 deletions scss/ui/helpers/_text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,7 @@ $text-fade-background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(25
height: $text-height-smallest;
}
}

.break-word {
word-wrap: break-word;
}
2 changes: 1 addition & 1 deletion src/controls/legend/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const OverlayLayer = function OverlayLayer(options) {
});
},
render() {
const labelCls = 'text-smaller padding-x-small grow pointer no-select overflow-hidden basis-50';
const labelCls = 'text-smaller padding-x-small grow pointer no-select overflow-hidden basis-50 break-word';
return `<div id="${this.getId()}" class="${labelCls}">${title}</div>`;
}
});
Expand Down
6 changes: 4 additions & 2 deletions src/getattributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ const getContent = {
suffix = attribute.suffix;
}
if (attribute.formatDatetime) {
const locale = 'locale' in attribute.formatDatetime ? attribute.formatDatetime.locale : 'default';
const options = 'options' in attribute.formatDatetime ? attribute.formatDatetime.options : { dateStyle: 'full', timeStyle: 'long' };
if (!Number.isNaN(Date.parse(featureValue))) {
const locale = 'locale' in attribute.formatDatetime ? attribute.formatDatetime.locale : 'default';
const options = 'options' in attribute.formatDatetime ? attribute.formatDatetime.options : { dateStyle: 'full', timeStyle: 'long' };
val = new Intl.DateTimeFormat(locale, options).format(Date.parse(featureValue));
} else if (!Number.isNaN(new Date(featureValue).getTime())) {
val = new Intl.DateTimeFormat(locale, options).format(new Date(featureValue));
}
}
if (attribute.url) {
Expand Down