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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 * @param {boolean} drawFocus | 132 * @param {boolean} drawFocus |
133 */ | 133 */ |
134 _updateCanvas: function(drawFocus) | 134 _updateCanvas: function(drawFocus) |
135 { | 135 { |
136 var context = this._xySlider.getContext("2d"); | 136 var context = this._xySlider.getContext("2d"); |
137 context.clearRect(0, 0, this._xySlider.width, this._xySlider.height); | 137 context.clearRect(0, 0, this._xySlider.width, this._xySlider.height); |
138 | 138 |
139 // Draw dashed axes. | 139 // Draw dashed axes. |
140 context.save(); | 140 context.save(); |
141 context.setLineDash([1, 1]); | 141 context.setLineDash([1, 1]); |
142 context.strokeStyle = "rgba(0, 0, 0, 0.2)"; | 142 context.strokeStyle = "rgba(210, 210, 210, 0.8)"; |
143 context.beginPath(); | 143 context.beginPath(); |
144 context.moveTo(this._halfCanvasSize, 0); | 144 context.moveTo(this._halfCanvasSize, 0); |
145 context.lineTo(this._halfCanvasSize, WebInspector.CSSShadowEditor.canvas
Size); | 145 context.lineTo(this._halfCanvasSize, WebInspector.CSSShadowEditor.canvas
Size); |
146 context.moveTo(0, this._halfCanvasSize); | 146 context.moveTo(0, this._halfCanvasSize); |
147 context.lineTo(WebInspector.CSSShadowEditor.canvasSize, this._halfCanvas
Size); | 147 context.lineTo(WebInspector.CSSShadowEditor.canvasSize, this._halfCanvas
Size); |
148 context.stroke(); | 148 context.stroke(); |
149 context.restore(); | 149 context.restore(); |
150 | 150 |
151 var thumbPoint = this._sliderThumbPosition(); | 151 var thumbPoint = this._sliderThumbPosition(); |
152 // Draw 2D slider line. | 152 // Draw 2D slider line. |
153 context.save(); | 153 context.save(); |
154 context.translate(this._halfCanvasSize, this._halfCanvasSize); | 154 context.translate(this._halfCanvasSize, this._halfCanvasSize); |
155 context.lineWidth = 2; | 155 context.lineWidth = 2; |
156 context.strokeStyle = "rgba(0, 0, 0, 0.3)"; | 156 context.strokeStyle = "rgba(130, 130, 130, 0.75)"; |
157 context.beginPath(); | 157 context.beginPath(); |
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(); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |