Changeset 17719 for trunk/FACT++/www/viewer
- Timestamp:
- 04/28/14 20:21:46 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/viewer/index.js
r17717 r17719 766 766 return; 767 767 768 var mouse = getClickPosition(); 768 // get click position relative to canvas 769 var rect = event.target.getBoundingClientRect(); 770 771 var x = event.clientX - rect.left; 772 var y = event.clientY - rect.top; 773 774 var mouse = { x: x, y: y }; 775 776 // convert click position to pixel index 769 777 var index = getIndex(event.target.id, mouse); 770 771 778 if (index<0) 772 779 return; … … 779 786 function getClickPosition(event) 780 787 { 781 var event = window.event;782 783 if (event.offsetX !== undefined && event.offsetY !== undefined)784 return { x: event.offsetX, y: event.offsetY };785 786 return { x: event.layerX, y: event.layerY};788 var rect = event.target.getBoundingClientRect(); 789 790 var x = event.clientX - rect.left; 791 var y = event.clientY - rect.top; 792 793 return { x: x, y: y }; 787 794 } 788 795
Note:
See TracChangeset
for help on using the changeset viewer.