Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: Source/devtools/front_end/elements/Spectrum.js

Issue 1315713003: DevTools: spectrum should switch to rgba upon adding alpha on drag. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Brian Grinstead All rights reserved. 2 * Copyright (C) 2011 Brian Grinstead All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 /** 152 /**
153 * @param {!Event} event 153 * @param {!Event} event
154 * @this {WebInspector.Spectrum} 154 * @this {WebInspector.Spectrum}
155 */ 155 */
156 function positionAlpha(event) 156 function positionAlpha(event)
157 { 157 {
158 var newAlpha = Math.round((event.x - this._hueAlphaLeft) / this._hueAlph aWidth * 100) / 100; 158 var newAlpha = Math.round((event.x - this._hueAlphaLeft) / this._hueAlph aWidth * 100) / 100;
159 var hsva = this._hsv.slice(); 159 var hsva = this._hsv.slice();
160 hsva[3] = Number.constrain(newAlpha, 0, 1); 160 hsva[3] = Number.constrain(newAlpha, 0, 1);
161 var colorFormat = undefined; 161 var colorFormat = undefined;
162 if (this._color().hasAlpha() && (this._colorFormat === WebInspector.Colo r.Format.ShortHEX || this._colorFormat === WebInspector.Color.Format.HEX || this ._colorFormat === WebInspector.Color.Format.Nickname)) 162 if (hsva[3] !== 1 && (this._colorFormat === WebInspector.Color.Format.Sh ortHEX || this._colorFormat === WebInspector.Color.Format.HEX || this._colorForm at === WebInspector.Color.Format.Nickname))
163 colorFormat = WebInspector.Color.Format.RGB; 163 colorFormat = WebInspector.Color.Format.RGB;
164 this._innerSetColor(hsva, "", colorFormat, WebInspector.Spectrum._Change Source.Other); 164 this._innerSetColor(hsva, "", colorFormat, WebInspector.Spectrum._Change Source.Other);
165 } 165 }
166 166
167 /** 167 /**
168 * @param {!Event} event 168 * @param {!Event} event
169 * @this {WebInspector.Spectrum} 169 * @this {WebInspector.Spectrum}
170 */ 170 */
171 function positionColor(event) 171 function positionColor(event)
172 { 172 {
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 "#8BC34A", 894 "#8BC34A",
895 "#CDDC39", 895 "#CDDC39",
896 "#FFEB3B", 896 "#FFEB3B",
897 "#FFC107", 897 "#FFC107",
898 "#FF9800", 898 "#FF9800",
899 "#FF5722", 899 "#FF5722",
900 "#795548", 900 "#795548",
901 "#9E9E9E", 901 "#9E9E9E",
902 "#607D8B" 902 "#607D8B"
903 ]}; 903 ]};
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698