-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMousable.js
More file actions
32 lines (31 loc) · 799 Bytes
/
Mousable.js
File metadata and controls
32 lines (31 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var compose = require('ksf/utils/compose');
var _Destroyable = require('ksf/base/_Destroyable');
var Elmt = require('./Element');
var ZPile = require('./ZPile');
var _ContentDelegate = require('./_ContentDelegate');
module.exports = compose(_Destroyable, _ContentDelegate, function(content) {
this.clickArea = new Elmt();
this._content = new ZPile().content([
content,
this.clickArea
]);
}, {
cursor: function(cursorType) {
this.clickArea.styleProp('cursor', cursorType);
return this;
},
on: function(domEventName, cb, key) {
this.clickArea.on(domEventName, cb);
this._own({
eventName: domEventName,
cb: cb
}, key);
return this;
},
off: function(key) {
var ev = this._owned[key];
this._unown(key);
this.clickArea.off(ev.eventName, ev.cb);
return this;
},
});