summaryrefslogtreecommitdiff
path: root/js/tool.js
blob: 9cbc107e679a4cd2b4298496cf0fc0d8e20132eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function Tool (span) {
	this.el = span
	this.lex = new Lex (span)
	this.name = span.innerHTML
	this.span = span
}
Tool.prototype.use = function(){}
Tool.prototype.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() }
}
Tool.prototype.blur = function(){
	current_tool = null
	this.span.classList.remove('focused')
}