|
|
|
|
|
|
|
|
|
|
public readonly HashSet<HitTestTarget> lastMoveTargets = new HashSet<HitTestTarget>(); |
|
|
|
|
|
|
|
readonly HashSet<HitTestEntry> _enteredTargets = new HashSet<HitTestEntry>(); |
|
|
|
|
|
|
|
void _handlePointerEvent(PointerEvent evt) { |
|
|
|
if (evt is PointerScrollEvent) { |
|
|
|
this._handlePointerScrollEvent(evt); |
|
|
|
|
|
|
HitTestResult result = new HitTestResult(); |
|
|
|
this.hitTest(result, evt.position); |
|
|
|
|
|
|
|
// enter event
|
|
|
|
D.assert(this._enteredTargets.Count == 0); |
|
|
|
foreach (var hitTestEntry in result.path) { |
|
|
|
if (this.lastMoveTargets.Contains(hitTestEntry.target)) { |
|
|
|
hitTestEntry.target.handleEvent(evt, hitTestEntry); |
|
|
|
|
|
|
hitTestEntry.target.handleEvent(new PointerEnterEvent( |
|
|
|
timeStamp: evt.timeStamp, |
|
|
|
pointer: evt.pointer, |
|
|
|
device: evt.device, |
|
|
|
kind: evt.kind |
|
|
|
), hitTestEntry); |
|
|
|
this._enteredTargets.Add(hitTestEntry); |
|
|
|
//leave events
|
|
|
|
foreach (var lastMoveTarget in this.lastMoveTargets) { |
|
|
|
lastMoveTarget.handleEvent(new PointerLeaveEvent( |
|
|
|
timeStamp: evt.timeStamp, |
|
|
|
|
|
|
), null); |
|
|
|
} |
|
|
|
|
|
|
|
//enter events
|
|
|
|
foreach (var hitTestEntry in this._enteredTargets) { |
|
|
|
hitTestEntry.target.handleEvent(new PointerEnterEvent( |
|
|
|
timeStamp: evt.timeStamp, |
|
|
|
pointer: evt.pointer, |
|
|
|
device: evt.device, |
|
|
|
kind: evt.kind |
|
|
|
), hitTestEntry); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this._enteredTargets.Clear(); |
|
|
|
|
|
|
|
this.dispatchEvent(evt, result); |
|
|
|
} |
|
|
|