StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
1.7 KiB
76 lines
1.7 KiB
import basePlugin from "./base.js";
|
|
import PointerEvent from "./PointerEvent.js";
|
|
|
|
function install(scope) {
|
|
scope.usePlugin(basePlugin);
|
|
const {
|
|
pointerEvents
|
|
} = scope; // don't repeat by default
|
|
|
|
pointerEvents.defaults.holdRepeatInterval = 0;
|
|
pointerEvents.types.push('holdrepeat');
|
|
}
|
|
|
|
function onNew({
|
|
pointerEvent
|
|
}) {
|
|
if (pointerEvent.type !== 'hold') {
|
|
return;
|
|
}
|
|
|
|
pointerEvent.count = (pointerEvent.count || 0) + 1;
|
|
}
|
|
|
|
function onFired({
|
|
interaction,
|
|
pointerEvent,
|
|
eventTarget,
|
|
targets
|
|
}, scope) {
|
|
if (pointerEvent.type !== 'hold' || !targets.length) {
|
|
return;
|
|
} // get the repeat interval from the first eventable
|
|
|
|
|
|
const interval = targets[0].eventable.options.holdRepeatInterval; // don't repeat if the interval is 0 or less
|
|
|
|
if (interval <= 0) {
|
|
return;
|
|
} // set a timeout to fire the holdrepeat event
|
|
|
|
|
|
interaction.holdIntervalHandle = setTimeout(() => {
|
|
scope.pointerEvents.fire({
|
|
interaction,
|
|
eventTarget,
|
|
type: 'hold',
|
|
pointer: pointerEvent,
|
|
event: pointerEvent
|
|
}, scope);
|
|
}, interval);
|
|
}
|
|
|
|
function endHoldRepeat({
|
|
interaction
|
|
}) {
|
|
// set the interaction's holdStopTime property
|
|
// to stop further holdRepeat events
|
|
if (interaction.holdIntervalHandle) {
|
|
clearInterval(interaction.holdIntervalHandle);
|
|
interaction.holdIntervalHandle = null;
|
|
}
|
|
}
|
|
|
|
const holdRepeat = {
|
|
id: 'pointer-events/holdRepeat',
|
|
install,
|
|
listeners: ['move', 'up', 'cancel', 'endall'].reduce((acc, enderTypes) => {
|
|
acc[`pointerEvents:${enderTypes}`] = endHoldRepeat;
|
|
return acc;
|
|
}, {
|
|
'pointerEvents:new': onNew,
|
|
'pointerEvents:fired': onFired
|
|
})
|
|
};
|
|
export default holdRepeat;
|
|
//# sourceMappingURL=holdRepeat.js.map
|