Merge pull request #11413 from mike-000/patch-12

Include scale option in RegularShape and Circle style constructors
This commit is contained in:
Andreas Hocevar
2020-08-10 09:44:08 +02:00
committed by GitHub
8 changed files with 70 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -8,6 +8,21 @@ import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import View from '../../../src/ol/View.js';
const ellipse = new Feature(new Point([-50, -50]));
ellipse.setStyle(
new Style({
image: new Circle({
radius: 30,
scale: [1, 0.5],
stroke: new Stroke({
color: '#00f',
width: 3,
}),
}),
})
);
const vectorSource = new VectorSource();
vectorSource.addFeatures([
@@ -23,6 +38,7 @@ vectorSource.addFeatures([
geometry: new Point([50, 50]),
radius: 30,
}),
ellipse,
]);
const style = new Style({

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -83,6 +83,25 @@ function createFeatures(stroke, fill, offSet = [0, 0]) {
})
);
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([8 + offSet[0], 30 + offSet[1]]),
});
// rectangle
feature.setStyle(
new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
radius: 10 / Math.SQRT2,
radius2: 10,
points: 4,
angle: 0,
scale: [1, 0.5],
}),
})
);
vectorSource.addFeature(feature);
}
createFeatures(new Stroke({width: 2}), new Fill({color: 'red'}));