Mercurial > pub > ImplabJs
comparison src/djol/ToolBoxController.js @ 34:27e8e9e38e07 default tip
Слияние
author | nickolay |
---|---|
date | Wed, 05 Jun 2019 20:44:15 +0300 |
parents | 8af8e840dd49 1dc2fd263b90 |
children |
comparison
equal
deleted
inserted
replaced
33:8af8e840dd49 | 34:27e8e9e38e07 |
---|---|
1 define([ | |
2 "dojo/_base/declare", | |
3 "implab/safe", | |
4 "implab/components/ActivationController", | |
5 "./ToolType" ], | |
6 | |
7 function(declare, safe, ActivationController, ToolType) { | |
8 return declare([ ActivationController ], { | |
9 _stack : null, | |
10 _tools : null, | |
11 | |
12 constructor : function() { | |
13 this._stack = new Array(); | |
14 this._tools = new Array(); | |
15 }, | |
16 | |
17 activate : function(tool) { | |
18 safe.argumentNotNull(tool, "tool"); | |
19 | |
20 var me = this, current = me.getCurrent(); | |
21 | |
22 return this.inherited(arguments).then(function(success) { | |
23 if (success) { | |
24 if (tool.toolType == ToolType.Oneshot && current) | |
25 me._stack.push(current); | |
26 else | |
27 me._stack = []; | |
28 } | |
29 return success; | |
30 }); | |
31 }, | |
32 | |
33 deactivate : function() { | |
34 var me = this; | |
35 return me.inherited(arguments).then(function(success) { | |
36 if (success && me._stack.length) | |
37 return me.activate(me._stack.pop()); | |
38 | |
39 return success; | |
40 }); | |
41 } | |
42 }); | |
43 }); |