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

Separate line and area linejoin styling in StyleEditor #1642

Merged
merged 2 commits into from
Sep 16, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions bundles/framework/oskariui/resources/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Oskari.registerLocalization({
color: 'Colour',
lineCap: 'Endings',
lineDash: 'Dash',
lineJoin: 'Corners',
width: 'Width',
area: {
color: 'Colour',
Expand Down
1 change: 1 addition & 0 deletions bundles/framework/oskariui/resources/locale/fi.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Oskari.registerLocalization({
color: 'Väri',
lineCap: 'Päädyt',
lineDash: 'Tyyli',
lineJoin: 'Kulmat',
width: 'Leveys',
area: {
color: 'Väri',
Expand Down
1 change: 1 addition & 0 deletions bundles/framework/oskariui/resources/locale/sv.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Oskari.registerLocalization({
color: 'Linjens färg',
lineCap: 'Linjens ändpunkter',
lineDash: 'Linjens stil',
lineJoin: 'Hörn',
width: 'Bredd',
area: {
color: 'Linjens färg',
Expand Down
8 changes: 8 additions & 0 deletions src/react/components/StyleEditor/AreaTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ export const AreaTab = ({oskariStyle}) => {
<SvgRadioButton options={ constants.LINE_STYLES.lineDash } />
</Form.Item>

<Form.Item
{ ...constants.ANTD_FORMLAYOUT }
name='stroke.area.lineJoin'
label={ <Message messageKey='StyleEditor.stroke.area.lineJoin' /> }
>
<SvgRadioButton options={ constants.LINE_STYLES.corners } />
</Form.Item>

<Form.Item
{ ...constants.ANTD_FORMLAYOUT }
name='fill.area.pattern'
Expand Down
4 changes: 2 additions & 2 deletions src/react/components/StyleEditor/LineTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export const LineTab = (props) => {

<Form.Item
{ ...constants.ANTD_FORMLAYOUT }
name='stroke.area.lineJoin'
label={ <Message messageKey='StyleEditor.stroke.area.lineJoin' /> }
name='stroke.lineJoin'
label={ <Message messageKey='StyleEditor.stroke.lineJoin' /> }
>
<SvgRadioButton options={ constants.LINE_STYLES.corners } />
</Form.Item>
Expand Down
5 changes: 3 additions & 2 deletions src/react/components/StyleEditor/OskariDefaultStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ export const OSKARI_BLANK_STYLE = {
color: '#000000', // stroke color
width: 3, // stroke width
lineDash: 'solid', // line dash, supported: dash, dashdot, dot, longdash, longdashdot and solid
lineCap: 'square', // line cap, supported: mitre, round and square
lineCap: 'square', // line cap, supported: butt, round and square
lineJoin: 'round', // line corner, supported: bevel, round and miter
area: {
color: '#000000', // area stroke color
width: 3, // area stroke width
lineDash: 'solid', // area line dash
lineJoin: 'miter' // area line corner
lineJoin: 'round' // area line corner, supported: bevel, round and miter
}
},
image: { // image style
Expand Down
3 changes: 2 additions & 1 deletion src/react/components/StyleEditor/Preview/StyleMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const getAreaPropsFromStyle = (style) => {
strokecolor: style.stroke.area.color,
size: style.stroke.area.width,
strokestyle: style.stroke.area.lineDash,
linejoin: style.stroke.area.lineJoin,
pattern: style.fill.area.pattern
};
};
Expand All @@ -46,7 +47,7 @@ const getLinePropsFromStyle = (style) => {
size: style.stroke.width,
linecap: style.stroke.lineCap,
linedash: style.stroke.lineDash,
linejoin: style.stroke.area.lineJoin
linejoin: style.stroke.lineJoin
};
};

Expand Down
4 changes: 2 additions & 2 deletions src/react/components/StyleEditor/Preview/area.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ const getPatternSVG = (areaFills, patternId) => {
*/
let patternIdCounter = 0;
export const getAreaSVG = (areaParams, areaFills) => {
const { color, strokecolor, size, strokestyle, pattern } = areaParams;
const { color, strokecolor, size, linejoin, strokestyle, pattern } = areaParams;
const path = parsePathFromSVG(areaPreviewSVG);

path.setAttribute('stroke', strokecolor);
path.setAttribute('stroke-width', size);
path.setAttribute('stroke-linecap', OSKARI_BLANK_STYLE.stroke.lineCap);
path.setAttribute('stroke-dasharray', strokestyle === 'dash' ? '4, 4': '');
path.setAttribute('stroke-linejoin', OSKARI_BLANK_STYLE.stroke.area.lineJoin);
path.setAttribute('stroke-linejoin', linejoin);

const patternId = 'patternPreview' + patternIdCounter++;
const fillPatternSVG = getPatternSVG(areaFills, pattern);
Expand Down