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

feature: new multiselectionstyle for features in active layer #1846

Merged
merged 11 commits into from
Oct 31, 2023

Conversation

jokd
Copy link
Contributor

@jokd jokd commented Sep 29, 2023

Fixes #1836
However since similar work will be done in #1773 I mark it as Draft.

New multiselectionstyle, inActiveLayer
@jokd jokd marked this pull request as ready for review October 20, 2023 08:56
@jokd
Copy link
Contributor Author

jokd commented Oct 20, 2023

Now it is good to test. Adds a new multiSelectionStyle, inActiveLayer that styles the features in the layer active in the infowindow. No need to change any config if you don't want to use this feature.

Note: This is only useful when using the multiselection tool with the tabbed layout (listLayout: false that is)

  "featureinfoOptions": {
    "infowindow": "infowindow",
    "multiSelectionStyles": {
		  "selected": [{
			"zIndex": 1,
			"fill": {
			  "color": [128, 128, 128, 0.13]
			},
			"stroke": {
			  "color": [0, 0, 0, 0.13],
			  "width": 3
			},
			"circle": {
			  "radius": 14,
			  "stroke": {
				"color": [0, 0, 0, 0.13],
				"width": 3
			  },
			  "fill": {
				"color": [128, 128, 128, 0.13]
			  }
			}
		  }],
		  "inActiveLayer": [{
			  "zIndex": 3,
			  "fill": {
				"color": [128, 128, 192, 0.4]
			  },
			  "stroke": {
				"color": [255, 255, 255, 1],
				"width": 4
			  },
			  "circle": {
				"radius": 14,
				"stroke": {
				  "color": [255, 255, 255, 1],
				  "width": 3
				},
				"fill": {
				  "color": [255, 255, 255, 0.01]
				}
			  }
			},
			{
			  "zIndex": 4,
			  "stroke": {
				"color": [220, 24, 24, 1],
				"width": 2
			  },
			  "circle": {
				"radius": 14,
				"stroke": {
				  "color": [220, 24, 24, 1],
				  "width": 2
				},
				"fill": {
				  "color": [128, 128, 192, 0.4]
				}
			  }
			}
		  ],
		  "highlighted": [{
			  "zIndex": 5,
			  "fill": {
				"color": [255, 255, 255, 0.6]
			  },
			  "stroke": {
				"color": [255, 255, 255, 1],
				"width": 6
			  },
			  "circle": {
				"radius": 14,
				"stroke": {
				  "color": [255, 255, 255, 1],
				  "width": 6
				},
				"fill": {
				  "color": [255, 255, 255, 0.01]
				}
			  }
			},
			{
			  "zIndex": 6,
			  "stroke": {
				"color": [48, 48, 255, 1],
				"width": 3
			  },
			  "circle": {
				"radius": 14,
				"stroke": {
				  "color": [48, 48, 255, 1],
				  "width": 3
				},
				"fill": {
				  "color": [255, 255, 255, 0.6]
				}
			  }
			}
		  ]
		}
	},

@steff-o
Copy link
Contributor

steff-o commented Oct 26, 2023

Does not work for me. It was clever to use the first part of id to determine if the feature belongs to the active layer. Maybe too clever as not all layers have the layer name as a part of the id. For example the origo-cities geojson does not work. Also AGS layers probably won't work. Also I'm not sure how that id corresponds to the selection group name, especially when the layer name parameter does not equal the layer id (when using the id parameter). Probably some lookup mechanism is needed if the feature itself shall not carry information of which layer it belongs to, something that we want to avoid.

Besides that you left a console.log and setting of property inAvctiveLayer in onItemAdded() which is probably never used.

@jokd
Copy link
Contributor Author

jokd commented Oct 26, 2023

Does not work for me. It was clever to use the first part of id to determine if the feature belongs to the active layer. Maybe too clever as not all layers have the layer name as a part of the id. For example the origo-cities geojson does not work. Also AGS layers probably won't work. Also I'm not sure how that id corresponds to the selection group name, especially when the layer name parameter does not equal the layer id (when using the id parameter). Probably some lookup mechanism is needed if the feature itself shall not carry information of which layer it belongs to, something that we want to avoid.

Besides that you left a console.log and setting of property inAvctiveLayer in onItemAdded() which is probably never used.

Right on. Hopefully this is fixed now

@steff-o
Copy link
Contributor

steff-o commented Oct 26, 2023

LGTM. That was a clever fix. If I could approve stuff I would.

As a side note: it is not only useful when using Multiselect as you wrote, it also works for ordinary featureInfo when infowindow is used.

@jokd jokd merged commit e06b796 into master Oct 31, 2023
4 checks passed
@jokd jokd deleted the new-selection-styles branch October 31, 2023 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display only selection for active layer in infowindow
2 participants