beyond-rails 0.0.244 → 0.0.245

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f179339d81c4a286242811536ee29a6b31742dba22745f3993f791dfa8736c5
4
- data.tar.gz: 120cc3d6aebf788c1e378a548598bf17fba7d92405301287af2f6dfc66f8cb4b
3
+ metadata.gz: 14a11baddc8aa18a29a74c0774442e2b5486b49ad44a7e435497176aa8a0c230
4
+ data.tar.gz: 92a0ac4ab51c30bac1f93cc092bb05c6ac4fd4e0c53eb792b983e967dd77f0a9
5
5
  SHA512:
6
- metadata.gz: 4c3fba25ec0fc14f267a90478cdc22c297e355664ac51b7b5600f064d2fe2394820c4c329dd2f336261276c8bd48a201e3f844fdb22cce41ac5484c038cc622e
7
- data.tar.gz: 0f77fedfad99572b6314319b24b86bd97b03b1513adae9d2812013caae24adb6e4d10bd12d3617aa65fb18c4a052cbd84de6a4b3b670a45d652ab067c368e4ac
6
+ metadata.gz: 480156108ca39681b88309ac8554648af5d2aa47dfcf9ee077a940f19f4fd87de40a3a630d5a9b81a3a5244529ca07d377ef94f7ff64a3189bd6a065e76c0cff
7
+ data.tar.gz: 1b458994269fcc000dd7e5b670e7c69cb816fe56e251a51b55ff7ce78a6925c6951df7897c1f21e86dc5d130def90f4d71c60167ec515ff1b3c0eb4d3cf1c482
@@ -1,5 +1,6 @@
1
1
  import supportDom from '../decorators/supportDom'
2
2
  import chartCommon from '../decorators/chartCommon'
3
+ import isFn from '../utils/isFn'
3
4
  import isDef from '../utils/isDef'
4
5
  import isUndef from '../utils/isUndef'
5
6
  import { throttle } from '../utils'
@@ -209,12 +210,25 @@ export default class PieChart {
209
210
  })
210
211
  }
211
212
 
212
- handleLabelMouseOver(index) {
213
- this.drawSliceGlow(this.data[index])
213
+ handleLabelMouseOver(event, index) {
214
+ const row = this.data[index]
215
+ this.drawSliceGlow(row)
216
+
217
+ if (isFn(this.options.onLabelMouseOver)) {
218
+ const canvasMousePos = this.getMousePosInCanvas(event)
219
+ const mousePos = this.getMousePos(canvasMousePos)
220
+ this.options.onLabelMouseOver(mousePos, row)
221
+ }
214
222
  }
215
223
 
216
- handleLabelMouseLeave(index) {
224
+ handleLabelMouseLeave(event, index) {
217
225
  this.clearSliceGlow()
226
+
227
+ if (isFn(this.options.onLabelMouseOver)) {
228
+ const canvasMousePos = this.getMousePosInCanvas(event)
229
+ const mousePos = this.getMousePos(canvasMousePos)
230
+ this.options.onLabelMouseOver(mousePos)
231
+ }
218
232
  }
219
233
 
220
234
  setData(arr) {
@@ -242,11 +242,11 @@ export default function chartCommon(target) {
242
242
  labelBox.appendChild(div)
243
243
 
244
244
  if (isFn(handleLabelMouseOver)) {
245
- const off = this.addEvent(div, 'mouseover', () => this.handleLabelMouseOver(i))
245
+ const off = this.addEvent(div, 'mouseover', event => this.handleLabelMouseOver(event, i))
246
246
  this.offLabels.push(off)
247
247
  }
248
248
  if (isFn(handleLabelMouseLeave)) {
249
- const off = this.addEvent(div, 'mouseleave', () => this.handleLabelMouseLeave(i))
249
+ const off = this.addEvent(div, 'mouseleave', event => this.handleLabelMouseLeave(event, i))
250
250
  this.offLabels.push(off)
251
251
  }
252
252
  })
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beyond-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.244
4
+ version: 0.0.245
5
5
  platform: ruby
6
6
  authors:
7
7
  - kmsheng