Fix double-tap and press for Study List on iOS (#164)
This commit is contained in:
parent
cd1b2dd221
commit
429dd7844e
@ -96,6 +96,34 @@ function handleCtrlClick($studyRow, data) {
|
|||||||
handler($studyRow, data);
|
handler($studyRow, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handlePress(event, instance) {
|
||||||
|
const $studyRow = $(event.currentTarget);
|
||||||
|
|
||||||
|
if (!instance.data.selected) {
|
||||||
|
doSelectSingleRow($studyRow, instance.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
OHIF.ui.showDropdown(OHIF.studylist.dropdown.getItems(), {
|
||||||
|
event,
|
||||||
|
menuClasses: 'dropdown-menu-left'
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDoubleClick(event, instance) {
|
||||||
|
if (event.which !== undefined && event.which !== 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dblClickOnStudy = OHIF.studylist.callbacks.dblClickOnStudy;
|
||||||
|
|
||||||
|
if (dblClickOnStudy && typeof dblClickOnStudy === 'function') {
|
||||||
|
dblClickOnStudy(instance.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Template.studylistStudy.onRendered(() => {
|
Template.studylistStudy.onRendered(() => {
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
const data = instance.data;
|
const data = instance.data;
|
||||||
@ -110,8 +138,20 @@ Template.studylistStudy.onRendered(() => {
|
|||||||
threshold: 30,
|
threshold: 30,
|
||||||
posThreshold: 30
|
posThreshold: 30
|
||||||
});
|
});
|
||||||
|
const press = new Hammer.Press();
|
||||||
|
|
||||||
|
mc.add(press);
|
||||||
mc.add(doubleTapRecognizer);
|
mc.add(doubleTapRecognizer);
|
||||||
|
|
||||||
|
mc.on('press', function(event) {
|
||||||
|
handlePress(event, instance);
|
||||||
|
});
|
||||||
|
|
||||||
|
mc.on('doubletap', function(event) {
|
||||||
|
handleDoubleClick(event, instance);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Check if current row has been previously selected
|
// Check if current row has been previously selected
|
||||||
if (data.selected) {
|
if (data.selected) {
|
||||||
doSelectRow($row, data);
|
doSelectRow($row, data);
|
||||||
@ -147,30 +187,6 @@ Template.studylistStudy.events({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'dblclick tr.studylistStudy, doubletap tr.studylistStudy'(event, instance) {
|
'dblclick tr.studylistStudy, doubletap tr.studylistStudy': handleDoubleClick,
|
||||||
if (event.which !== undefined && event.which !== 1) {
|
'contextmenu tr.studylistStudy, press tr.studylistStudy': handlePress,
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dblClickOnStudy = OHIF.studylist.callbacks.dblClickOnStudy;
|
|
||||||
|
|
||||||
if (dblClickOnStudy && typeof dblClickOnStudy === 'function') {
|
|
||||||
dblClickOnStudy(instance.data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
'contextmenu tr.studylistStudy, press tr.studylistStudy'(event, instance) {
|
|
||||||
const $studyRow = $(event.currentTarget);
|
|
||||||
|
|
||||||
if (!instance.data.selected) {
|
|
||||||
doSelectSingleRow($studyRow, instance.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
OHIF.ui.showDropdown(OHIF.studylist.dropdown.getItems(), {
|
|
||||||
event,
|
|
||||||
menuClasses: 'dropdown-menu-left'
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user