OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
8 */ | 8 */ |
9 WebInspector.CSSShadowEditor = function() | 9 WebInspector.CSSShadowEditor = function() |
10 { | 10 { |
(...skipping 24 matching lines...) Expand all Loading... |
35 this._xySlider.addEventListener("keydown", this._onCanvasArrowKey.bind(this)
, false); | 35 this._xySlider.addEventListener("keydown", this._onCanvasArrowKey.bind(this)
, false); |
36 this._xySlider.addEventListener("blur", this._onCanvasBlur.bind(this), false
); | 36 this._xySlider.addEventListener("blur", this._onCanvasBlur.bind(this), false
); |
37 | 37 |
38 var blurField = this.contentElement.createChild("div", "shadow-editor-blur-f
ield"); | 38 var blurField = this.contentElement.createChild("div", "shadow-editor-blur-f
ield"); |
39 this._blurInput = this._createTextInput(blurField, WebInspector.UIString("Bl
ur")); | 39 this._blurInput = this._createTextInput(blurField, WebInspector.UIString("Bl
ur")); |
40 this._blurSlider = this._createSlider(blurField); | 40 this._blurSlider = this._createSlider(blurField); |
41 | 41 |
42 this._spreadField = this.contentElement.createChild("div", "shadow-editor-fi
eld"); | 42 this._spreadField = this.contentElement.createChild("div", "shadow-editor-fi
eld"); |
43 this._spreadInput = this._createTextInput(this._spreadField, WebInspector.UI
String("Spread")); | 43 this._spreadInput = this._createTextInput(this._spreadField, WebInspector.UI
String("Spread")); |
44 this._spreadSlider = this._createSlider(this._spreadField); | 44 this._spreadSlider = this._createSlider(this._spreadField); |
45 } | 45 }; |
46 | 46 |
47 /** @enum {symbol} */ | 47 /** @enum {symbol} */ |
48 WebInspector.CSSShadowEditor.Events = { | 48 WebInspector.CSSShadowEditor.Events = { |
49 ShadowChanged: Symbol("ShadowChanged") | 49 ShadowChanged: Symbol("ShadowChanged") |
50 } | 50 }; |
51 | 51 |
52 /** @type {number} */ | 52 /** @type {number} */ |
53 WebInspector.CSSShadowEditor.maxRange = 20; | 53 WebInspector.CSSShadowEditor.maxRange = 20; |
54 /** @type {string} */ | 54 /** @type {string} */ |
55 WebInspector.CSSShadowEditor.defaultUnit = "px"; | 55 WebInspector.CSSShadowEditor.defaultUnit = "px"; |
56 /** @type {number} */ | 56 /** @type {number} */ |
57 WebInspector.CSSShadowEditor.sliderThumbRadius = 6; | 57 WebInspector.CSSShadowEditor.sliderThumbRadius = 6; |
58 /** @type {number} */ | 58 /** @type {number} */ |
59 WebInspector.CSSShadowEditor.canvasSize = 88; | 59 WebInspector.CSSShadowEditor.canvasSize = 88; |
60 | 60 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 context.moveTo(0, 0); | 158 context.moveTo(0, 0); |
159 context.lineTo(thumbPoint.x, thumbPoint.y); | 159 context.lineTo(thumbPoint.x, thumbPoint.y); |
160 context.stroke(); | 160 context.stroke(); |
161 // Draw 2D slider thumb. | 161 // Draw 2D slider thumb. |
162 if (drawFocus) { | 162 if (drawFocus) { |
163 context.beginPath(); | 163 context.beginPath(); |
164 context.fillStyle = "rgba(66, 133, 244, 0.4)"; | 164 context.fillStyle = "rgba(66, 133, 244, 0.4)"; |
165 context.arc(thumbPoint.x, thumbPoint.y, WebInspector.CSSShadowEditor
.sliderThumbRadius + 2, 0, 2 * Math.PI); | 165 context.arc(thumbPoint.x, thumbPoint.y, WebInspector.CSSShadowEditor
.sliderThumbRadius + 2, 0, 2 * Math.PI); |
166 context.fill(); | 166 context.fill(); |
167 } | 167 } |
168 context.beginPath() | 168 context.beginPath(); |
169 context.fillStyle = "#4285F4"; | 169 context.fillStyle = "#4285F4"; |
170 context.arc(thumbPoint.x, thumbPoint.y, WebInspector.CSSShadowEditor.sli
derThumbRadius, 0, 2 * Math.PI); | 170 context.arc(thumbPoint.x, thumbPoint.y, WebInspector.CSSShadowEditor.sli
derThumbRadius, 0, 2 * Math.PI); |
171 context.fill(); | 171 context.fill(); |
172 context.restore(); | 172 context.restore(); |
173 }, | 173 }, |
174 | 174 |
175 /** | 175 /** |
176 * @param {!Event} event | 176 * @param {!Event} event |
177 */ | 177 */ |
178 _onButtonClick: function(event) | 178 _onButtonClick: function(event) |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 * @return {!WebInspector.Geometry.Point} | 432 * @return {!WebInspector.Geometry.Point} |
433 */ | 433 */ |
434 _sliderThumbPosition: function() | 434 _sliderThumbPosition: function() |
435 { | 435 { |
436 var x = (this._model.offsetX().amount / WebInspector.CSSShadowEditor.max
Range) * this._innerCanvasSize; | 436 var x = (this._model.offsetX().amount / WebInspector.CSSShadowEditor.max
Range) * this._innerCanvasSize; |
437 var y = (this._model.offsetY().amount / WebInspector.CSSShadowEditor.max
Range) * this._innerCanvasSize; | 437 var y = (this._model.offsetY().amount / WebInspector.CSSShadowEditor.max
Range) * this._innerCanvasSize; |
438 return this._constrainPoint(new WebInspector.Geometry.Point(x, y), this.
_innerCanvasSize); | 438 return this._constrainPoint(new WebInspector.Geometry.Point(x, y), this.
_innerCanvasSize); |
439 }, | 439 }, |
440 | 440 |
441 __proto__: WebInspector.VBox.prototype | 441 __proto__: WebInspector.VBox.prototype |
442 } | 442 }; |
OLD | NEW |