Skip to content

Commit

Permalink
Merge 2f8bc28 into fe0445a
Browse files Browse the repository at this point in the history
  • Loading branch information
hwbllmnn committed Jun 14, 2021
2 parents fe0445a + 2f8bc28 commit 82b943e
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/Button/DigitizeButton/DigitizeButton.jsx
Expand Up @@ -518,7 +518,6 @@ class DigitizeButton extends React.Component {
map,
drawType,
editType,
drawStyle,
onFeatureSelect
} = this.props;

Expand All @@ -532,9 +531,6 @@ class DigitizeButton extends React.Component {
this._digitizeFeatures = digitizeLayer.getSource().getFeaturesCollection();

if (pressed) {
if (drawStyle) {
digitizeLayer.setStyle(this.getDigitizeStyleFunction);
}
if (drawType) {
this.createDrawInteraction(pressed);
} else if (editType) {
Expand Down Expand Up @@ -596,12 +592,18 @@ class DigitizeButton extends React.Component {
drawStyle,
} = this.props;

let styleObj;
if (!feature.getGeometry()) {
return null;
}

if (drawStyle) {
return isFunction(drawStyle) ? drawStyle(feature) : drawStyle;
}

switch (feature.getGeometry().getType()) {
case DigitizeButton.POINT_DRAW_TYPE: {
if (!feature.get('isLabel')) {
styleObj = drawStyle || new OlStyleStyle({
return new OlStyleStyle({
image: new OlStyleCircle({
radius: 7,
fill: new OlStyleFill({
Expand All @@ -613,7 +615,7 @@ class DigitizeButton extends React.Component {
})
});
} else {
styleObj = drawStyle || new OlStyleStyle({
return new OlStyleStyle({
text: new OlStyleText({
text: feature.get('label'),
offsetX: 5,
Expand All @@ -628,20 +630,18 @@ class DigitizeButton extends React.Component {
})
});
}
return styleObj;
}
case DigitizeButton.LINESTRING_DRAW_TYPE: {
styleObj = drawStyle || new OlStyleStyle({
return new OlStyleStyle({
stroke: new OlStyleStroke({
color: DigitizeButton.DEFAULT_STROKE_COLOR,
width: 2
})
});
return styleObj;
}
case DigitizeButton.POLYGON_DRAW_TYPE:
case DigitizeButton.CIRCLE_DRAW_TYPE: {
styleObj = drawStyle || new OlStyleStyle({
return new OlStyleStyle({
fill: new OlStyleFill({
color: DigitizeButton.DEFAULT_FILL_COLOR
}),
Expand All @@ -650,10 +650,9 @@ class DigitizeButton extends React.Component {
width: 2
})
});
return styleObj;
}
default: {
break;
return null;
}
}
}
Expand Down

0 comments on commit 82b943e

Please sign in to comment.