@masterportal/masterportalapi 2.15.0 → 2.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
 
4
4
  The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
5
5
 
6
+ ## 2.15.1 - 2023-03-09
7
+ ### Fixed
8
+ - The `labelField` attribute is now evaluated correctly for a text style.
9
+ - The styling for clustered features works now.
10
+
11
+ ---
12
+
6
13
  ## 2.15.0 - 2023-02-28
7
14
  ### Added
8
15
  - WebGL Render-Pipeline for all VectorLayer types can be called using {"renderer": "webgl"} in config.json
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@masterportal/masterportalapi",
3
3
  "author": "Implementierungspartnerschaft Masterportal <info@masterportal.org> (https://www.masterportal.org)",
4
- "version": "2.15.0",
4
+ "version": "2.15.1",
5
5
  "license": "MIT",
6
6
  "description": "Basic functions of the Masterportal as api",
7
7
  "repository": {
@@ -46,8 +46,12 @@ class PointStyle extends StyleClass {
46
46
  * @returns {ol/style} - The created style.
47
47
  */
48
48
  getStyle () {
49
- const type = this.attributes.type.toLowerCase(),
50
- isClustered = this.isClustered;
49
+ const isClustered = this.isClustered;
50
+ let type = this.attributes.type.toLowerCase();
51
+
52
+ if (isClustered && this.feature.get("features")?.length > 1) {
53
+ type = this.attributes.clusterType.toLowerCase();
54
+ }
51
55
 
52
56
  if (type === "icon") {
53
57
  return createIconStyle(this.attributes, this.feature, isClustered);
@@ -38,7 +38,7 @@ class TextStyle extends StyleClass {
38
38
  getStyle () {
39
39
  const isClustered = this.isClustered,
40
40
  feature = this.feature,
41
- labelField = this.labelField;
41
+ labelField = this.attributes.labelField;
42
42
 
43
43
  if (isClustered && feature.get("features")?.length > 1 && this.attributes.clusterTextType !== "none") {
44
44
  return this.createClusteredTextStyle();
@@ -1,19 +1,26 @@
1
1
  import PointStyle from "../../../../src/vectorStyle/styles/point/stylePoint";
2
- import {Style} from "ol/style.js";
2
+ import {Circle as CircleStyle, Style} from "ol/style.js";
3
3
 
4
4
  describe("stylePoint", () => {
5
- const feature = {
5
+ let feature,
6
+ isClustered,
7
+ style,
8
+ stylePointClass;
9
+
10
+ beforeEach(() => {
11
+ feature = {
6
12
  geometryName: "geom",
7
13
  id: "DE.HH.UP_GESUNDHEIT_KRANKENHAEUSER_2"
8
- },
14
+ };
9
15
  style = {
10
16
  type: "icon",
11
17
  clusterType: "icon",
12
18
  legendValue: "Krankenhaus",
13
19
  imageName: "krankenhaus.png"
14
- },
15
- isClustered = false,
20
+ };
21
+ isClustered = false;
16
22
  stylePointClass = new PointStyle(feature, style, isClustered);
23
+ });
17
24
 
18
25
  describe("setSize", function () {
19
26
  it("defines setSize()", () => {
@@ -24,5 +31,18 @@ describe("stylePoint", () => {
24
31
  it("returns an instance of openlayers style", () => {
25
32
  expect(stylePointClass.getStyle()).toBeInstanceOf(Style);
26
33
  });
34
+ it("returns an instance of openlayers circleStyle", () => {
35
+ isClustered = true;
36
+ style = {
37
+ type: "icon",
38
+ clusterType: "circle",
39
+ legendValue: "Krankenhaus",
40
+ imageName: "krankenhaus.png"
41
+ };
42
+
43
+ expect(stylePointClass.getStyle()).toBeInstanceOf(Style);
44
+ expect(stylePointClass.getStyle().getImage()).toBeInstanceOf(CircleStyle);
45
+ });
27
46
  });
47
+
28
48
  });
@@ -16,7 +16,8 @@ describe("styleText", () => {
16
16
  type: "icon",
17
17
  clusterType: "icon",
18
18
  legendValue: "Krankenhaus",
19
- imageName: "krankenhaus.png"
19
+ imageName: "krankenhaus.png",
20
+ labelField: ""
20
21
  },
21
22
  isClustered = false,
22
23
  styleTextClass = new TextStyle(feature, style, isClustered);