Skip to content

Commit

Permalink
Decrease popup padding. #141
Browse files Browse the repository at this point in the history
  • Loading branch information
paul121 committed Dec 7, 2021
2 parents 7fc9dd1 + f227e1e commit e90a9f8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Enforce that every pull request includes updates to the CHANGELOG.md (this) file.
- Add simple example of using the `instance.addPopup` method.

### Changed

- Change the Github release workflow to use softprops/action-gh-release v0.1.13.
- Decrease the popup padding.

## [v2.0.2] - 2021-09-13

Expand Down
8 changes: 8 additions & 0 deletions examples/simple-html-consumer/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
myMap.addBehavior("sidePanel");
myMap.addBehavior("layerSwitcherInSidePanel");
myMap.addBehavior("snappingGrid");

// Display popup with coordinates when not clicking a feature.
myMap.addPopup(function (event) {
var feature = myMap.map.forEachFeatureAtPixel(event.pixel, function(feature, layer) { return feature; });
if (!feature) {
return '<div><h2>Coordinates</h2><p>' + event.coordinate + '</p></div>';
}
});
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,8 @@
.layer-switcher.shown {
max-height: 300px;
}

/* Popup styles. */
.ol-popup {
padding: 0.75em;
}

0 comments on commit e90a9f8

Please sign in to comment.