MouseOverArea.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2017
  5. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. */
  7. define(['baglass/core-client/js/core-client/ui/core/View'], function (View) {
  8. var MouseOverArea = View.extend({
  9. /**
  10. * options.onActivate - a function that will be called when the mouse is over the element associated with this view.
  11. */
  12. init: function init(options) {
  13. MouseOverArea.inherited('init', this, arguments);
  14. this.onActivate = options.onActivate;
  15. // mouseover vs. mouseenter - it doesn't make any difference right now, but if children end up getting added to
  16. // the associated element, then mouseover will trigger when the mouse is over those children too, which is better
  17. // for us I think.
  18. this.$el.on('mouseover', this.onActivate);
  19. },
  20. remove: function remove() {
  21. this.$el.off('mouseover', this.onActivate);
  22. MouseOverArea.inherited('remove', this, arguments);
  23. }
  24. });
  25. return MouseOverArea;
  26. });
  27. //# sourceMappingURL=MouseOverArea.js.map