vega-scenegraph
Advanced tools
Comparing version 4.11.0 to 4.11.1
{ | ||
"name": "vega-scenegraph", | ||
"version": "4.11.0", | ||
"version": "4.11.1", | ||
"description": "Vega scenegraph and renderers.", | ||
@@ -29,3 +29,3 @@ "license": "BSD-3-Clause", | ||
}, | ||
"gitHead": "3580b28ec9b89d0a042707c168080931e7745fb3" | ||
"gitHead": "8304f8a1fc37050404dad69338c0515cb82464ba" | ||
} |
import Handler from './Handler'; | ||
import Marks from './marks/index'; | ||
import { | ||
ClickEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, Events, | ||
HrefEvent, MouseWheelEvent, PointerDownEvent, PointerMoveEvent, PointerOutEvent, | ||
PointerOverEvent, TooltipHideEvent, TooltipShowEvent, | ||
ClickEvent, | ||
DragEnterEvent, DragLeaveEvent, DragOverEvent, Events, HrefEvent, | ||
MouseDownEvent, MouseMoveEvent, MouseOutEvent, MouseOverEvent, | ||
MouseWheelEvent, | ||
PointerDownEvent, PointerMoveEvent, PointerOutEvent, PointerOverEvent, | ||
TooltipHideEvent, TooltipShowEvent, | ||
TouchEndEvent, TouchMoveEvent, TouchStartEvent | ||
@@ -45,3 +48,7 @@ } from './util/events'; | ||
function move(moveEvent, overEvent, outEvent) { | ||
function fireAll(handler, types, event) { | ||
types.forEach(type => handler.fire(type, event)); | ||
} | ||
function move(moveEvents, overEvents, outEvents) { | ||
return function(evt) { | ||
@@ -53,3 +60,3 @@ const a = this._active, | ||
// active item and picked item are the same | ||
this.fire(moveEvent, evt); // fire move | ||
fireAll(this, moveEvents, evt); // fire move | ||
} else { | ||
@@ -60,7 +67,7 @@ // active item and picked item are different | ||
// suppress if active item was removed from scene | ||
this.fire(outEvent, evt); | ||
fireAll(this, outEvents, evt); | ||
} | ||
this._active = p; // set new active item | ||
this.fire(overEvent, evt); // fire over for new active item | ||
this.fire(moveEvent, evt); // fire move for new active item | ||
this._active = p; // set new active item | ||
fireAll(this, overEvents, evt); // fire over for new active item | ||
fireAll(this, moveEvents, evt); // fire move for new active item | ||
} | ||
@@ -70,5 +77,5 @@ }; | ||
function inactive(type) { | ||
function inactive(types) { | ||
return function(evt) { | ||
this.fire(type, evt); | ||
fireAll(this, types, evt); | ||
this._active = null; | ||
@@ -83,4 +90,7 @@ }; | ||
// add minimal events required for proper state management | ||
[ClickEvent, PointerDownEvent, PointerMoveEvent, PointerOutEvent, DragLeaveEvent] | ||
.forEach(type => eventListenerCheck(this, type)); | ||
[ | ||
ClickEvent, MouseDownEvent, | ||
PointerDownEvent, PointerMoveEvent, PointerOutEvent, | ||
DragLeaveEvent | ||
].forEach(type => eventListenerCheck(this, type)); | ||
@@ -108,7 +118,11 @@ return Handler.prototype.initialize.call(this, el, origin, obj); | ||
pointermove: move(PointerMoveEvent, PointerOverEvent, PointerOutEvent), | ||
dragover: move(DragOverEvent, DragEnterEvent, DragLeaveEvent), | ||
pointermove: move( | ||
[PointerMoveEvent, MouseMoveEvent], | ||
[PointerOverEvent, MouseOverEvent], | ||
[PointerOutEvent, MouseOutEvent] | ||
), | ||
dragover: move([DragOverEvent], [DragEnterEvent], [DragLeaveEvent]), | ||
pointerout: inactive(PointerOutEvent), | ||
dragleave: inactive(DragLeaveEvent), | ||
pointerout: inactive([PointerOutEvent, MouseOutEvent]), | ||
dragleave: inactive([DragLeaveEvent]), | ||
@@ -120,2 +134,7 @@ pointerdown(evt) { | ||
mousedown(evt) { | ||
this._down = this._active; | ||
this.fire(MouseDownEvent, evt); | ||
}, | ||
click(evt) { | ||
@@ -122,0 +141,0 @@ if (this._down === this._active) { |
@@ -7,12 +7,12 @@ export const KeyDownEvent = 'keydown'; | ||
export const DragOverEvent = 'dragover'; | ||
export const PointerDownEvent = 'pointerdown'; | ||
export const PointerUpEvent = 'pointerup'; | ||
export const PointerMoveEvent = 'pointermove'; | ||
export const PointerOutEvent = 'pointerout'; | ||
export const PointerOverEvent = 'pointerover'; | ||
export const MouseDownEvent = 'mousedown'; | ||
export const PointerDownEvent = 'pointerdown'; | ||
export const MouseUpEvent = 'mouseup'; | ||
export const PointerUpEvent = 'pointerup'; | ||
export const MouseMoveEvent = 'mousemove'; | ||
export const PointerMoveEvent = 'pointermove'; | ||
export const MouseOutEvent = 'mouseout'; | ||
export const PointerOutEvent = 'pointerout'; | ||
export const MouseOverEvent = 'mouseover'; | ||
export const PointerOverEvent = 'pointerover'; | ||
export const ClickEvent = 'click'; | ||
@@ -38,2 +38,7 @@ export const DoubleClickEvent = 'dblclick'; | ||
PointerOverEvent, | ||
MouseDownEvent, | ||
MouseUpEvent, | ||
MouseMoveEvent, | ||
MouseOutEvent, | ||
MouseOverEvent, | ||
ClickEvent, | ||
@@ -40,0 +45,0 @@ DoubleClickEvent, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
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
1020246
19019