aboutsummaryrefslogtreecommitdiff
path: root/js/components/tools-properties/ink-bottle-properties.reel/ink-bottle-properties.js
blob: 6d5c46f646c15c43b32f5097fe92de2c0cc5df45 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* <copyright>
This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
(c) Copyright 2011 Motorola Mobility, Inc.  All Rights Reserved.
</copyright> */

var Montage = require("montage/core/core").Montage,
    ShapesController = require("js/controllers/elements/shapes-controller").ShapesController,
    ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties;

exports.InkBottleProperties = Montage.create(ToolProperties, {

    _subPrepare: {
        value: function() {
            Object.defineBinding(this._strokeMaterial, "items", {
                boundObject: this.application.ninja.appModel,
                boundObjectPropertyPath: "materials",
                oneway: false
            });
        }
    },

    handleAction: {
        value: function(event) {
            var ch = event.currentTarget,
                val = event.currentTarget.identifier;
            switch(val) {
                case "useBorderWidth":
                    if(ch.checked) {
                        this.borderWidthLabel.element.classList.remove("disabled");
                        this._borderWidth.enabled = true;
                    } else {
                        this.borderWidthLabel.element.classList.add("disabled");
                        this._borderWidth.enabled = false;
                    }
                    break;
                case "useBorderStyle":
                    if(ch.checked) {
                        this.borderStyleLabel.element.classList.remove("disabled");
                        this._borderStyle.removeAttribute("disabled")
                    } else {
                        this.borderStyleLabel.element.classList.add("disabled");
                        this._borderStyle.setAttribute("disabled", "disabled");
                    }
                    break;
                case "useStrokeSize":
                    if(ch.checked) {
                        this.strokeSizeLabel.element.classList.remove("disabled");
                        this._strokeSize.enabled = true
                    } else {
                        this.strokeSizeLabel.element.classList.add("disabled");
                        this._strokeSize.enabled = false;
                    }
                    break;
                case "useWebGl":
                    (ch.checked) ? this._materialsContainer.style["display"] = "" : this._materialsContainer.style["display"] = "none";
                    break;
            }
        }
    }
});