Advertisement
Guest User

Untitled

a guest
Oct 14th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var ScrollbarMouseWheel = pc.createScript('scrollbarMouseWheel');
  2.  
  3.  
  4. ScrollbarMouseWheel.attributes.add('steps', {
  5.     type:'number'
  6. });
  7.  
  8. // initialize code called once per entity
  9. ScrollbarMouseWheel.prototype.initialize = function() {
  10.     this.scrollbar = this.entity.scrollbar;
  11.     this.app.mouse.on(pc.EVENT_MOUSEWHEEL, this.onMouseWheel, this);
  12. };
  13.  
  14.  
  15. ScrollbarMouseWheel.prototype.onMouseWheel = function(event) {
  16.     //console.log("val:"+event.wheelDelta);
  17.     this.scrollbar.value = this.scrollbar.value += (event.wheelDelta * this.steps);
  18. };
  19.  
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement