MouseWheel.js 871 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2017
  5. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. */
  7. define(['../../lib/@waca/core-client/js/core-client/ui/core/Class'], function (Class) {
  8. var MouseWheel = null;
  9. MouseWheel = Class.extend({
  10. iOffset: 44, //Wheel scroll increment
  11. getOffset: function getOffset(oEvent) {
  12. var iDir;
  13. if (oEvent.type === 'DOMMouseScroll') {
  14. iDir = oEvent.originalEvent.detail > 0 ? 1 : -1;
  15. } else if (oEvent.type === 'wheel') {
  16. iDir = oEvent.originalEvent.deltaX > 0 ? 1 : -1;
  17. } else {
  18. iDir = oEvent.originalEvent.wheelDelta > 0 ? -1 : 1;
  19. }
  20. return this.iOffset * iDir;
  21. }
  22. });
  23. return new MouseWheel();
  24. });
  25. //# sourceMappingURL=MouseWheel.js.map