Skip to content

Commit

Permalink
Experimental support for click-highlighting/brushing vertices and con…
Browse files Browse the repository at this point in the history
…nected edges (issue #62)

Also preparing support for crosstalk (issue #65)
  • Loading branch information
bwlewis committed Jun 28, 2017
1 parent 5681b96 commit 6bb4ece
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 10 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ URL: http://bwlewis.github.io/rthreejs
BugReports: https://github.com/bwlewis/rthreejs/issues
License: MIT + file LICENSE
Depends:
R (>= 3.0.0), igraph (>= 1.0.0)
R (>= 3.0.0),
igraph (>= 1.0.0)
Imports:
htmlwidgets (>= 0.3.2),
base64enc,
Expand All @@ -26,4 +27,4 @@ Suggests:
htmltools (>= 0.2.6),
maps
Enhances: knitr, shiny
RoxygenNote: 6.0.1
RoxygenNote: 5.0.1
6 changes: 6 additions & 0 deletions R/graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@
#' clicked, include list entries labeled \code{"1"} and \code{"5"}.
#' See the demos in \code{demo(package="threejs")} for detailed examples.
#'
#' @section Other interactions:
#' Specify the argument \code{brush=TRUE} to highlight a clicked vertex and
#' its directly connected edges (click off of a vertex to reset the display).
#' Optionally set the \code{highlight=<hex color>} and \code{lowlight=<hex color>}
#' to manually control the brushing display colors.
#'
#' @note
#' Edge transparency values specified as part of \code{edge.color} are ignored, however
#' you can set an overall transparency for edges with \code{edge.alpha}.
Expand Down
4 changes: 3 additions & 1 deletion inst/htmlwidgets/scatterplotThree.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,10 @@ Widget.scatter = function(w, h)
_this.brushed = null;
return;
}
var off = new THREE.Color("lightgray"); // XXX make option
var off = new THREE.Color("lightgray");
var on = new THREE.Color("red");
if(_this.options.highlight) on = new THREE.Color(_this.options.highlight);
if(_this.options.lowlight) off = new THREE.Color(_this.options.lowlight);
if(! Array.isArray(vertices)) vertices = [vertices]; // XXX why does this become a string?
var k;
for(var j = 0; j < _this.pointgroup.children.length; j++)
Expand Down
1 change: 1 addition & 0 deletions man/LeMis.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/ego.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/flights.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/gcol.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/globejs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions man/graphjs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/lines3d.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/points3d.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/scatterplot3js.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/texture.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/threejs-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/threejs-shiny.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6bb4ece

Please sign in to comment.