@d3fc/d3fc-pointer
Advanced tools
Comparing version 2.0.9 to 2.0.10
@@ -7,69 +7,44 @@ (function (global, factory) { | ||
var createReboundMethod = (function (target, source, name) { | ||
var method = source[name]; | ||
if (typeof method !== 'function') { | ||
throw new Error('Attempt to rebind ' + name + ' which isn\'t a function on the source object'); | ||
} | ||
return function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var createReboundMethod = ((target, source, name) => { | ||
const method = source[name]; | ||
var value = method.apply(source, args); | ||
return value === source ? target : value; | ||
}; | ||
if (typeof method !== 'function') { | ||
throw new Error(`Attempt to rebind ${name} which isn't a function on the source object`); | ||
} | ||
return (...args) => { | ||
var value = method.apply(source, args); | ||
return value === source ? target : value; | ||
}; | ||
}); | ||
var rebind = (function (target, source) { | ||
for (var _len = arguments.length, names = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
names[_key - 2] = arguments[_key]; | ||
} | ||
var rebind = ((target, source, ...names) => { | ||
for (const name of names) { | ||
target[name] = createReboundMethod(target, source, name); | ||
} | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator = names[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var name = _step.value; | ||
target[name] = createReboundMethod(target, source, name); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
return target; | ||
return target; | ||
}); | ||
var pointer = (function () { | ||
var event = d3Dispatch.dispatch('point'); | ||
var event = d3Dispatch.dispatch('point'); | ||
function mousemove() { | ||
var point = d3Selection.mouse(this); | ||
event.call('point', this, [{ x: point[0], y: point[1] }]); | ||
} | ||
function mousemove() { | ||
var point = d3Selection.mouse(this); | ||
event.call('point', this, [{ | ||
x: point[0], | ||
y: point[1] | ||
}]); | ||
} | ||
function mouseleave() { | ||
void event.call('point', this, []); | ||
} | ||
function mouseleave() { | ||
void event.call('point', this, []); | ||
} | ||
var instance = function instance(selection) { | ||
selection.on('mouseenter.pointer', mousemove).on('mousemove.pointer', mousemove).on('mouseleave.pointer', mouseleave); | ||
}; | ||
var instance = function instance(selection) { | ||
selection.on('mouseenter.pointer', mousemove).on('mousemove.pointer', mousemove).on('mouseleave.pointer', mouseleave); | ||
}; | ||
rebind(instance, event, 'on'); | ||
return instance; | ||
rebind(instance, event, 'on'); | ||
return instance; | ||
}); | ||
@@ -76,0 +51,0 @@ |
@@ -6,2 +6,10 @@ # Change Log | ||
## [2.0.10](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-pointer@2.0.9...@d3fc/d3fc-pointer@2.0.10) (2019-09-04) | ||
**Note:** Version bump only for package @d3fc/d3fc-pointer | ||
<a name="2.0.9"></a> | ||
@@ -8,0 +16,0 @@ ## [2.0.9](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-pointer@2.0.8...@d3fc/d3fc-pointer@2.0.9) (2019-08-12) |
{ | ||
"name": "@d3fc/d3fc-pointer", | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"description": "Component which emits the current mouse or touch position over a selection", | ||
@@ -26,3 +26,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@d3fc/d3fc-rebind": "^5.0.8", | ||
"@d3fc/d3fc-rebind": "^5.0.9", | ||
"d3-dispatch": "^1.0.1", | ||
@@ -33,3 +33,4 @@ "d3-selection": "^1.0.2" | ||
"access": "public" | ||
} | ||
}, | ||
"gitHead": "d216bebca76b9bde7456f1c06e768bc67814dd2e" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11760
11
153
1
Updated@d3fc/d3fc-rebind@^5.0.9