diff options
Diffstat (limited to 'js/tools/InkBottleTool.js')
-rw-r--r-- | js/tools/InkBottleTool.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/js/tools/InkBottleTool.js b/js/tools/InkBottleTool.js new file mode 100644 index 00000000..cc20d94c --- /dev/null +++ b/js/tools/InkBottleTool.js | |||
@@ -0,0 +1,69 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | ModifierToolBase = require("js/tools/modifier-tool-base").ModifierToolBase, | ||
9 | ElementsMediator = require("js/mediators/element-mediator").ElementMediator; | ||
10 | |||
11 | exports.InkBottleTool = Montage.create(ModifierToolBase, { | ||
12 | _canSnap: { value: false }, | ||
13 | _canColor: { value: true }, | ||
14 | |||
15 | HandleMouseMove: { | ||
16 | value : function (event) | ||
17 | { | ||
18 | var obj = this.application.ninja.stage.GetElement(event); | ||
19 | var cursor = "url('images/cursors/ink.png') 17 12, default"; | ||
20 | var canColor = true; | ||
21 | if (obj) | ||
22 | { | ||
23 | var name = obj.nodeName; | ||
24 | if ((name !== 'CANVAS') && (name !== 'DIV')) | ||
25 | { | ||
26 | cursor = "url('images/cursors/ink_no.png') 17 12, default"; | ||
27 | canColor = false; | ||
28 | } | ||
29 | } | ||
30 | this.application.ninja.stage.drawingCanvas.style.cursor = cursor; | ||
31 | this._canColor = canColor; | ||
32 | } | ||
33 | }, | ||
34 | |||
35 | HandleLeftButtonUp: { | ||
36 | value : function () { | ||
37 | //if(this._isDrawing) | ||
38 | { | ||
39 | this.application.ninja.stage.clearDrawingCanvas(); | ||
40 | this._hasDraw = false; | ||
41 | this._isDrawing = false; | ||
42 | } | ||
43 | } | ||
44 | }, | ||
45 | |||
46 | // Called by modifier tool base's HandleLeftButtonDown after updating selection (if needed) | ||
47 | startDraw: { | ||
48 | value: function(event) { | ||
49 | this.isDrawing = true; | ||
50 | |||
51 | if(this._canColor) | ||
52 | { | ||
53 | // var color = this.application.ninja.colorController.colorToolbar.stroke; | ||
54 | // ElementsMediator.setColor(this.application.ninja.selectedElements, color, false, "Change", "inkBottleTool"); | ||
55 | |||
56 | var strokeInfo = { borderStyle:this.options._borderStyle.value, | ||
57 | borderWidth:this.options._borderWidth.value, | ||
58 | borderUnits:this.options._borderWidth.units, | ||
59 | strokeSize:this.options._strokeSize.value, | ||
60 | strokeUnits:this.options._strokeSize.units, | ||
61 | color:this.application.ninja.colorController.colorToolbar.stroke | ||
62 | }; | ||
63 | |||
64 | ElementsMediator.setStroke(this.application.ninja.selectedElements, strokeInfo, "Change", "inkBottleTool"); | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | |||
69 | }); \ No newline at end of file | ||