Skip to content

Commit

Permalink
Add strokeWidth and currentStrokeWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntadpear committed Sep 29, 2018
1 parent c9f9a63 commit 6fac177
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ The `l-choropleth-layer` component pass the this information through its [defaul
* **max**: The highest value on the domain set
* **strokeColor**: String with the color to use for each of the polygons' stroke color (in hex format). (e.g.: ```"e7d090"```). If a value is not specified ```fff``` is used.
* **currentStrokeColor**: String with the color to use for the stroke of the currently polygon that the user is hovering over. (e.g.: ```"e7d090"```). If a value is not specified ```666``` is used.
* **strokeWidth**: Number with the width of the stroke for each polygon. (default: ```2```).
* **currentStrokeWidth**: Number with the width of the stroke for the currently hovered polygon. (default: ```5```).
As seen on the example, usually you'll pass these values to the `l-info-control` and `l-reference-chart` components.
Expand Down
14 changes: 8 additions & 6 deletions src/components/ChoroplethLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getMin, getMax, normalizeValue, getColor, validNumber } from "../util"
function mouseover({ target }) {
target.setStyle({
weight: 5,
weight: this.currentStrokeWidth,
color: `#${this.currentStrokeColor}`,
dashArray: ""
})
Expand Down Expand Up @@ -40,7 +40,7 @@ function mouseover({ target }) {
function mouseout({ target }) {
target.setStyle({
weight: 2,
weight: this.strokeWidth,
color: `#${this.strokeColor}`,
dashArray: ""
})
Expand All @@ -62,7 +62,9 @@ export default {
zoom: Number,
mapOptions: Object,
strokeColor: {type: String, default: 'fff'},
currentStrokeColor: {type: String, default:'666'}
currentStrokeColor: {type: String, default:'666'},
strokeWidth: {type: Number, default: 2},
currentStrokeWidth: {type: Number, default: 5}
},
mounted() {
if (this.$parent._isMounted) {
Expand All @@ -81,20 +83,20 @@ export default {
if (!item) {
return {
color: "white",
weight: 2
weight: this.strokeWidth
}
}
let valueParam = Number(item[this.value.key])
if (!validNumber(valueParam)) {
return {
color: "white",
weight: 2
weight: this.strokeWidth
}
}
const { min, max } = this
return {
weight: 2,
weight: this.strokeWidth,
opacity: 1,
color: `#${this.strokeColor}`,
dashArray: "3",
Expand Down

0 comments on commit 6fac177

Please sign in to comment.