Skip to content

Commit

Permalink
update Glify to 3.3.0, remove arr.splice workaround, remove tooltip i…
Browse files Browse the repository at this point in the history
…n hoverOff
  • Loading branch information
trafficonese committed Jun 22, 2024
1 parent b509362 commit af381dd
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 32 deletions.
15 changes: 9 additions & 6 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ features and improvements
* New method *clearGlGroup* removes a group from leaflet and the Leaflet.Glify instances.
* The JavaScript methods of the `removeGl**` functions was rewritten to correctly remove an element identified by `layerId`
* `clearGlLayers` now correctly removes all Leaflet.Glify instances
* When showing/hiding Leaflet.Glify layers, they are set to active = TRUE/FALSE to make mouseevents work again. #48, #50
* When showing/hiding Leaflet.Glify layers, they are set to active = TRUE/FALSE to make mouseevents work again. #48 #50

bug fixes

* src version now works also in shiny. #71
* added `popupOptions` and `labelOptions`. #83
* added `stroke` (default=TRUE) in `addGlPolygons` and `addGlPolygonsSrc` for drawing borders. #3
* Labels work similar to `leaflet`. `leafgl` accepts a single string, a vector of strings or a formula. #78
* The `...` arguments are now passed to all methods in the underlying library. This allows us to set
* Increase precision of points, lines and shapes by translating them closer to the Pixel Origin. Thanks @RayLarone #93
* src version now works also in shiny. #71
* added `popupOptions` and `labelOptions`. #83
* added `stroke` (default=TRUE) in `addGlPolygons` and `addGlPolygonsSrc` for drawing borders. #3 #68
* Labels work similar to `leaflet`. `leafgl` accepts a single string, a vector of strings or a formula. #78
* The `...` arguments are now passed to all methods in the underlying library. This allows us to set
additional arguments like `fragmentShaderSource`, `sensitivity` or `sensitivityHover`.

documentation etc
Expand All @@ -24,6 +25,8 @@ documentation etc

miscellaneous

* update upstream javascript dependency to 3.3.0. #49
Note: If you previously used the workaround `L.glify.Shapes.instances.splice(0, 1)`, please remove it with this new version.
* unified / simplified the dependency functions/calls


Expand Down
32 changes: 25 additions & 7 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,55 @@

#### ✨ features and improvements

- Switched from `jsonify` and `geojsonsf` to `yyjsonr`
- New method `clearGlGroup` removes a group from leaflet and the Leaflet.Glify instances.
- The JavaScript methods of the `removeGl**` functions was rewritten to correctly remove an element identified by `layerId`
- `clearGlLayers` now correctly removes all Leaflet.Glify instances
- When showing/hiding Leaflet.Glify layers, they are set to active = TRUE/FALSE to make mouseevents work again. [#48](https://github.com/r-spatial/leafgl/issues/48) [#50](https://github.com/r-spatial/leafgl/issues/50)

#### 🐛 bug fixes

* src version now works also in shiny. #71
- Increase precision of points, lines and shapes by translating them closer to the Pixel Origin. Thanks @RayLarone [#93](https://github.com/r-spatial/leafgl/issues/93)
- src version now works also in shiny. [#71](https://github.com/r-spatial/leafgl/issues/71)
- added `popupOptions` and `labelOptions`. [#83](https://github.com/r-spatial/leafgl/issues/83)
- added `stroke` (default=TRUE) in `addGlPolygons` and `addGlPolygonsSrc` for drawing borders. [#3](https://github.com/r-spatial/leafgl/issues/3) [#68](https://github.com/r-spatial/leafgl/issues/68)
- Labels work similar to `leaflet`. `leafgl` accepts a single string, a vector of strings or a formula. [#78](https://github.com/r-spatial/leafgl/issues/78)
- The `...` arguments are now passed to all methods in the underlying library. This allows us to set additional arguments like `fragmentShaderSource`, `sensitivity` or `sensitivityHover`. [#81](https://github.com/r-spatial/leafgl/issues/81)

#### 💬 documentation etc

- Added some @details for Shiny click and mouseover events and their corresponding input. [#77](https://github.com/r-spatial/leafgl/issues/77)
- Use `@inheritParams leaflet::**` for identical function arguments

#### 🍬 miscellaneous

- update upstream javascript dependency to 3.3.0. [#49](https://github.com/r-spatial/leafgl/issues/49)

⚠️If you previously used the workaround `L.glify.Shapes.instances.splice(0, 1)`, please remove it with this new version.

- unified / simplified the dependency functions/calls

## leafgl 0.2.1

new features:

* all methods can now have labels/tooltips. Currently only lines and polygons support passing of a column name, points need a predefined label vector.
- all methods can now have labels/tooltips. Currently only lines and polygons support passing of a column name, points need a predefined label vector.

miscallaneous:

* all methods now have a pane argument to control layer ordering (thanks to @trafficonese). #67 #64
- all methods now have a pane argument to control layer ordering (thanks to @trafficonese). [#67](https://github.com/r-spatial/leafgl/issues/67) [#64](https://github.com/r-spatial/leafgl/issues/64)

## leafgl 0.2.0

miscallaneous:

* update upstream javascript dependency to 3.2.0
- update upstream javascript dependency to 3.2.0

## leafgl 0.1.2

new features:

* expose additional JavaScript arguments in addGlPoints via magic dots. #54 & #60

- expose additional JavaScript arguments in addGlPoints via magic dots. [#54](https://github.com/r-spatial/leafgl/issues/54) & [#60](https://github.com/r-spatial/leafgl/issues/60)

## leafgl 0.1.1

Expand Down
4 changes: 0 additions & 4 deletions inst/htmlwidgets/Leaflet.glify/GlifyUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,18 @@ LeafletWidget.methods.clearGlLayers = function() {
arr[i].settings.map.off("mousemove");
arr[i].remove();
}
arr.splice(0, arr.length)

arr = L.glify.linesInstances;
for( let i = 0; i < arr.length; i++){
arr[i].settings.map.off("mousemove");
arr[i].remove();
}
arr.splice(0, arr.length)

arr = L.glify.pointsInstances;
for( let i = 0; i < arr.length; i++){
arr[i].settings.map.off("mousemove");
arr[i].remove();
}
arr.splice(0, arr.length)

this.layerManager.clearLayers("glify");
};
Expand All @@ -76,7 +73,6 @@ LeafletWidget.methods.clearGlGroup = function(group) {
if ( arr[i].settings.className === group) {
arr[i].settings.map.off("mousemove");
arr[i].remove();
arr.splice(i, 1);
}
}
});
Expand Down
6 changes: 6 additions & 0 deletions inst/htmlwidgets/Leaflet.glify/addGlifyPoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ LeafletWidget.methods.addGlifyPoints = function(data, cols, popup, label, opacit
map: map,
click: clickFun,
hover: mouseoverFun,
hoverOff: function(e, feat) {
tooltip.remove();
//if (HTMLWidgets.shinyMode) {
// Shiny.setInputValue(map.id + "_glify_mouseover", null);
//}
},
data: data,
color: clrs,
opacity: opacity,
Expand Down
7 changes: 7 additions & 0 deletions inst/htmlwidgets/Leaflet.glify/addGlifyPolygons.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ LeafletWidget.methods.addGlifyPolygons = function(data, cols, popup, label,
map: map,
click: clickFun,
hover: mouseoverFun,
hoverOff: function(e, feat) {
tooltip.remove();
//if (HTMLWidgets.shinyMode) {
// Shiny.setInputValue(map.id + "_glify_mouseover", null);
//}
},
data: data,
color: clrs,
opacity: opacity,
Expand All @@ -53,3 +59,4 @@ LeafletWidget.methods.addGlifyPolygons = function(data, cols, popup, label,




6 changes: 6 additions & 0 deletions inst/htmlwidgets/Leaflet.glify/addGlifyPolylines.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ LeafletWidget.methods.addGlifyPolylines = function(data, cols, popup, label,
map: map,
click: clickFun,
hover: mouseoverFun,
hoverOff: function(e, feat) {
tooltip.remove();
//if (HTMLWidgets.shinyMode) {
// Shiny.setInputValue(map.id + "_glify_mouseover", null);
//}
},
latitudeKey: 1,
longitudeKey: 0,
data: data,
Expand Down
Loading

0 comments on commit af381dd

Please sign in to comment.