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

Highlight mouseover elements (WIP) #75

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ L.glify.shapes({
click: (e, feature): boolean | void => {
// do something when a shape is clicked
// return false to continue traversing
},
hover: (e, feature): boolean | void => {
// do something when a shape is hovered
}
});
```
Expand All @@ -50,6 +53,9 @@ L.glify.points({
click: (e, pointOrGeoJsonFeature, xy): boolean | void => {
// do something when a point is clicked
// return false to continue traversing
},
hover: (e, pointOrGeoJsonFeature, xy): boolean | void => {
// do something when a point is hovered
}
});
```
Expand All @@ -63,6 +69,9 @@ L.glify.lines({
click: (e, feature): boolean | void => {
// do something when a line is clicked
// return false to continue traversing
},
hover: (e, feature): boolean | void => {
// do something when a line is hovered
}
});
```
Expand All @@ -73,10 +82,15 @@ L.glify.lines({
* `vertexShaderSource` `{String|Function}` optional glsl vertex shader source, defaults to use `L.glify.shader.vertex`
* `fragmentShaderSource` `{String|Function}` optional glsl fragment shader source, defaults to use `L.glify.shader.fragment.polygon`
* `click` `{Function}` optional event handler for clicking a shape
* `hover` `{Function}` optional event handler for hovering a shape
* `color` `{Function|Object|String}` optional, default is 'random'
* When `color` is a `Function` its arguments are gets the `index`:`number`, and the `feature`:`object` that is being colored
* When `color` is a `Function` its arguments are the `index`:`number`, and the `feature`:`object` that is being colored
* `opacity` {Number} a value from 0 to 1, default is 0.5
* `className` {String} a class name applied to canvas, default is ''
* `highlight` `{Object|Boolean}` Should the hovered shape be highlighted? Only active, when `hover` is set.
* The `Object` can contain:
* `color` {Array} a color RGB array, default is `{"r":1, "g":0, "b":0}`
* `opacity` {Number} a value from 0 to 1, default is `0.8`
* `preserveDrawingBuffer` {Boolean} optional, default `false`, perverse draw buffer on webgl context.
* CAUTION: May cause performance issue with large data sets.

Expand All @@ -86,13 +100,20 @@ L.glify.lines({
* `vertexShaderSource` `{String|Function}` optional glsl vertex shader source, defaults to use `L.glify.shader.vertex`
* `fragmentShaderSource` `{String|Function}` optional glsl fragment shader source, defaults to use `L.glify.shader.fragment.point`
* `click` `{Function}` optional event handler for clicking a point
* `hover` `{Function}` optional event handler for hovering a point
* `color` `{Function|Object|String}` optional, default is 'random'
* When `color` is a `Function` its arguments are gets the `index`:`number`, and the `point`:`array` that is being colored
* When `color` is a `Function` its arguments are the `index`:`number`, and the `point`:`array` that is being colored
* `opacity` {Number} a value from 0 to 1, default is 0.8
* `className` {String} a class name applied to canvas, default is ''
* `size` {Number|Function} pixel size of point
* When `size` is a `Function` its arguments are `index`:`number`, and the `point`:`array` that is being sized
* `sensitivity` {Number} exaggerates the size of the clickable area to make it easier to click a point
* `sensitivityHover` {Number} exaggerates the size of the hoverable area to make it easier to hover a point
* `highlight` `{Object|Boolean}` Should the hovered point be highlighted? Only active, when `hover` is set.
* The `Object` can contain:
* `color` {Array} a color RGB array, default is `{"r":1, "g":0, "b":0}`
* `size` {Number} a value by which the original `size` is multiplied, default is `1.5`
* `opacity` {Number} a value from 0 to 1, default is `0.8`
* `preserveDrawingBuffer` {Boolean} optional, default `false`, perverse draw buffer on webgl context.
* CAUTION: May cause performance issue with large data sets.

Expand All @@ -101,15 +122,23 @@ L.glify.lines({
* `data` `{Object}` required geojson data
* `vertexShaderSource` `{String|Function}` optional glsl vertex shader source, defaults to use `L.glify.shader.vertex`
* `fragmentShaderSource` `{String|Function}` optional glsl fragment shader source, defaults to use `L.glify.shader.fragment.point`
* `click` `{Function}` optional event handler for clicking a point
* `click` `{Function}` optional event handler for clicking a line
* `hover` `{Function}` optional event handler for hovering a line
* `color` `{Function|Object|String}` optional, default is 'random'
* When `color` is a `Function` its arguments are gets the `index`:`number`, and the `point`:`array` that is being colored
* When `color` is a `Function` its arguments are the `index`:`number`, and the `point`:`array` that is being colored
* `opacity` {Number} a value from 0 to 1, default is 0.5
* `className` {String} a class name applied to canvas, default is ''
* `sensitivity` {Number} exaggerates the size of the clickable area to make it easier to click a line
* `sensitivityHover` {Number} exaggerates the size of the hoverable area to make it easier to hover a line
* `highlight` `{Object|Boolean}` Should the hovered line be highlighted? Only active, when `hover` is set.
* The `Object` can contain:
* `color` {Array} a color RGB array, default is `{"r":1, "g":0, "b":0}`
* `size` {Number} a value by which the original `weight` is multiplied, default is `1.5`
* `opacity` {Number} a value from 0 to 1, default is `0.8`
* `preserveDrawingBuffer` {Boolean} optional, default `false`, perverse draw buffer on webgl context.
* CAUTION: May cause performance issue with large data sets.
* `weight` {Number|Function} a value in pixels of how thick lines should be drawn
* When `weight` is a `Function` its arguments are gets the `index`:`number`, and the `feature`:`object` that is being drawn
* When `weight` is a `Function` its arguments are the `index`:`number`, and the `feature`:`object` that is being drawn
* CAUTION: Zoom of more than 18 will turn weight internally to 1 to prevent WebGL precision rendering issues.

## `L.glify` methods
Expand All @@ -118,6 +147,7 @@ L.glify.lines({
* `instances`
* `points(options)`
* `shapes(options)`
* `lines(options)`

## Contributors

Expand Down
40 changes: 20 additions & 20 deletions dist/glify-browser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/glify-browser.js.map

Large diffs are not rendered by default.

Loading