summaryrefslogtreecommitdiff
path: root/js/tool.js
blob: 190f29f3d2f22ad8910402e4f7c0b2b2ceee7e0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var Tool = Model({
	init: function (span) {
		this.el = span
		this.lex = new Lex (span)
		this.name = span.innerHTML
		this.span = span
	},
	use: function(){},
	focus: function(){
		// focused && focused.blur()
		current_tool && current_tool.blur()
		current_tool = this
		this.span.classList.add('focused')
		this.use()
		if (this.name != 'shader') { cursor_input.focus() }
	},
	blur: function(){
		current_tool = null
		this.span.classList.remove('focused')
	}
})

var Checkbox = Tool.extend({
})