private void notifyCancel (Layer except, CaptureMode exceptMode, E source) { E oldEvent = event; event = newCancelEvent(source); try { if (bubble) { Depth depth = Depth.BELOW; for (Layer target = hitLayer; target != null; target = target.parent()) { if (target == except) depth = Depth.AT; else if (depth == Depth.AT) depth = Depth.ABOVE; if (exceptMode != null && exceptMode.allow(depth)) continue; dispatch(target); } } else { if (hitLayer != except) dispatch(hitLayer); } } finally { this.event = oldEvent; } }