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.
61 lines
1.2 KiB
61 lines
1.2 KiB
4 years ago
|
'use strict'
|
||
|
|
||
|
function mouseButtons(ev) {
|
||
|
if(typeof ev === 'object') {
|
||
|
if('buttons' in ev) {
|
||
|
return ev.buttons
|
||
|
} else if('which' in ev) {
|
||
|
var b = ev.which
|
||
|
if(b === 2) {
|
||
|
return 4
|
||
|
} else if(b === 3) {
|
||
|
return 2
|
||
|
} else if(b > 0) {
|
||
|
return 1<<(b-1)
|
||
|
}
|
||
|
} else if('button' in ev) {
|
||
|
var b = ev.button
|
||
|
if(b === 1) {
|
||
|
return 4
|
||
|
} else if(b === 2) {
|
||
|
return 2
|
||
|
} else if(b >= 0) {
|
||
|
return 1<<b
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return 0
|
||
|
}
|
||
|
exports.buttons = mouseButtons
|
||
|
|
||
|
function mouseElement(ev) {
|
||
|
return ev.target || ev.srcElement || window
|
||
|
}
|
||
|
exports.element = mouseElement
|
||
|
|
||
|
function mouseRelativeX(ev) {
|
||
|
if(typeof ev === 'object') {
|
||
|
if('offsetX' in ev) {
|
||
|
return ev.offsetX
|
||
|
}
|
||
|
var target = mouseElement(ev)
|
||
|
var bounds = target.getBoundingClientRect()
|
||
|
return ev.clientX - bounds.left
|
||
|
}
|
||
|
return 0
|
||
|
}
|
||
|
exports.x = mouseRelativeX
|
||
|
|
||
|
function mouseRelativeY(ev) {
|
||
|
if(typeof ev === 'object') {
|
||
|
if('offsetY' in ev) {
|
||
|
return ev.offsetY
|
||
|
}
|
||
|
var target = mouseElement(ev)
|
||
|
var bounds = target.getBoundingClientRect()
|
||
|
return ev.clientY - bounds.top
|
||
|
}
|
||
|
return 0
|
||
|
}
|
||
|
exports.y = mouseRelativeY
|