| OLD | NEW |
| 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 30 matching lines...) Expand all Loading... |
| 41 icon.setAttribute("height", 16); | 41 icon.setAttribute("height", 16); |
| 42 icon.setAttribute("width", 16); | 42 icon.setAttribute("width", 16); |
| 43 var path = icon.createSVGChild("path"); | 43 var path = icon.createSVGChild("path"); |
| 44 path.setAttribute("d", "M5,6 L11,6 L8,2 Z M5,10 L11,10 L8,14 Z"); | 44 path.setAttribute("d", "M5,6 L11,6 L8,2 Z M5,10 L11,10 L8,14 Z"); |
| 45 return icon; | 45 return icon; |
| 46 } | 46 } |
| 47 | 47 |
| 48 WebInspector.VBox.call(this, true); | 48 WebInspector.VBox.call(this, true); |
| 49 this.registerRequiredCSS("components/spectrum.css"); | 49 this.registerRequiredCSS("components/spectrum.css"); |
| 50 this.contentElement.tabIndex = 0; | 50 this.contentElement.tabIndex = 0; |
| 51 this.setDefaultFocusedElement(this.contentElement); |
| 51 | 52 |
| 52 this._colorElement = this.contentElement.createChild("div", "spectrum-color"
); | 53 this._colorElement = this.contentElement.createChild("div", "spectrum-color"
); |
| 53 this._colorDragElement = this._colorElement.createChild("div", "spectrum-sat
fill").createChild("div", "spectrum-val fill").createChild("div", "spectrum-dra
gger"); | 54 this._colorDragElement = this._colorElement.createChild("div", "spectrum-sat
fill").createChild("div", "spectrum-val fill").createChild("div", "spectrum-dra
gger"); |
| 54 var contrastRatioSVG = this._colorElement.createSVGChild("svg", "spectrum-co
ntrast-container fill"); | 55 var contrastRatioSVG = this._colorElement.createSVGChild("svg", "spectrum-co
ntrast-container fill"); |
| 55 this._contrastRatioLine = contrastRatioSVG.createSVGChild("path", "spectrum-
contrast-line"); | 56 this._contrastRatioLine = contrastRatioSVG.createSVGChild("path", "spectrum-
contrast-line"); |
| 56 | 57 |
| 57 var toolbar = new WebInspector.Toolbar("spectrum-eye-dropper", this.contentE
lement); | 58 var toolbar = new WebInspector.Toolbar("spectrum-eye-dropper", this.contentE
lement); |
| 58 this._colorPickerButton = new WebInspector.ToolbarToggle(WebInspector.UIStri
ng("Toggle color picker"), "eyedropper-toolbar-item"); | 59 this._colorPickerButton = new WebInspector.ToolbarToggle(WebInspector.UIStri
ng("Toggle color picker"), "eyedropper-toolbar-item"); |
| 59 this._colorPickerButton.setToggled(true); | 60 this._colorPickerButton.setToggled(true); |
| 60 this._colorPickerButton.addEventListener("click", this._toggleColorPicker.bi
nd(this, undefined)); | 61 this._colorPickerButton.addEventListener("click", this._toggleColorPicker.bi
nd(this, undefined)); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 return; | 222 return; |
| 222 if (show) | 223 if (show) |
| 223 this._updatePalettePanel(); | 224 this._updatePalettePanel(); |
| 224 this._focus(); | 225 this._focus(); |
| 225 this._palettePanelShowing = show; | 226 this._palettePanelShowing = show; |
| 226 this.contentElement.classList.toggle("palette-panel-showing", show); | 227 this.contentElement.classList.toggle("palette-panel-showing", show); |
| 227 }, | 228 }, |
| 228 | 229 |
| 229 _focus: function() | 230 _focus: function() |
| 230 { | 231 { |
| 231 if (this.isShowing() && WebInspector.currentFocusElement() !== this.cont
entElement) | 232 if (this.isShowing()) |
| 232 WebInspector.setCurrentFocusElement(this.contentElement); | 233 this.contentElement.focus(); |
| 233 }, | 234 }, |
| 234 | 235 |
| 235 /** | 236 /** |
| 236 * @param {string} colorText | 237 * @param {string} colorText |
| 237 * @param {number=} animationDelay | 238 * @param {number=} animationDelay |
| 238 * @return {!Element} | 239 * @return {!Element} |
| 239 */ | 240 */ |
| 240 _createPaletteColor: function(colorText, animationDelay) | 241 _createPaletteColor: function(colorText, animationDelay) |
| 241 { | 242 { |
| 242 var element = createElementWithClass("div", "spectrum-palette-color"); | 243 var element = createElementWithClass("div", "spectrum-palette-color"); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 this._shadesContainer.style.left = colorElement.offsetLeft + "px"; | 322 this._shadesContainer.style.left = colorElement.offsetLeft + "px"; |
| 322 colorElement.classList.add("spectrum-shades-shown"); | 323 colorElement.classList.add("spectrum-shades-shown"); |
| 323 | 324 |
| 324 var shades = WebInspector.Spectrum.MaterialPaletteShades[colorText]; | 325 var shades = WebInspector.Spectrum.MaterialPaletteShades[colorText]; |
| 325 for (var i = shades.length - 1; i >= 0; i--) { | 326 for (var i = shades.length - 1; i >= 0; i--) { |
| 326 var shadeElement = this._createPaletteColor(shades[i], i * 200 / sha
des.length + 100); | 327 var shadeElement = this._createPaletteColor(shades[i], i * 200 / sha
des.length + 100); |
| 327 shadeElement.addEventListener("mousedown", this._paletteColorSelecte
d.bind(this, shades[i], false)); | 328 shadeElement.addEventListener("mousedown", this._paletteColorSelecte
d.bind(this, shades[i], false)); |
| 328 this._shadesContainer.appendChild(shadeElement); | 329 this._shadesContainer.appendChild(shadeElement); |
| 329 } | 330 } |
| 330 | 331 |
| 331 WebInspector.setCurrentFocusElement(this._shadesContainer); | 332 this._shadesContainer.focus(); |
| 332 this._shadesCloseHandler = closeLightnessShades.bind(this, colorElement)
; | 333 this._shadesCloseHandler = closeLightnessShades.bind(this, colorElement)
; |
| 333 this._shadesContainer.ownerDocument.addEventListener("mousedown", this._
shadesCloseHandler, true); | 334 this._shadesContainer.ownerDocument.addEventListener("mousedown", this._
shadesCloseHandler, true); |
| 334 }, | 335 }, |
| 335 | 336 |
| 336 /** | 337 /** |
| 337 * @param {!Event} e | 338 * @param {!Event} e |
| 338 * @return {number} | 339 * @return {number} |
| 339 */ | 340 */ |
| 340 _slotIndexForEvent: function(e) | 341 _slotIndexForEvent: function(e) |
| 341 { | 342 { |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 "#FFEB3B": ["#FFFDE7", "#FFF9C4", "#FFF59D", "#FFF176", "#FFEE58", "#FFEB3B"
, "#FDD835", "#FBC02D", "#F9A825", "#F57F17"], | 1018 "#FFEB3B": ["#FFFDE7", "#FFF9C4", "#FFF59D", "#FFF176", "#FFEE58", "#FFEB3B"
, "#FDD835", "#FBC02D", "#F9A825", "#F57F17"], |
| 1018 "#FFC107": ["#FFF8E1", "#FFECB3", "#FFE082", "#FFD54F", "#FFCA28", "#FFC107"
, "#FFB300", "#FFA000", "#FF8F00", "#FF6F00"], | 1019 "#FFC107": ["#FFF8E1", "#FFECB3", "#FFE082", "#FFD54F", "#FFCA28", "#FFC107"
, "#FFB300", "#FFA000", "#FF8F00", "#FF6F00"], |
| 1019 "#FF9800": ["#FFF3E0", "#FFE0B2", "#FFCC80", "#FFB74D", "#FFA726", "#FF9800"
, "#FB8C00", "#F57C00", "#EF6C00", "#E65100"], | 1020 "#FF9800": ["#FFF3E0", "#FFE0B2", "#FFCC80", "#FFB74D", "#FFA726", "#FF9800"
, "#FB8C00", "#F57C00", "#EF6C00", "#E65100"], |
| 1020 "#FF5722": ["#FBE9E7", "#FFCCBC", "#FFAB91", "#FF8A65", "#FF7043", "#FF5722"
, "#F4511E", "#E64A19", "#D84315", "#BF360C"], | 1021 "#FF5722": ["#FBE9E7", "#FFCCBC", "#FFAB91", "#FF8A65", "#FF7043", "#FF5722"
, "#F4511E", "#E64A19", "#D84315", "#BF360C"], |
| 1021 "#795548": ["#EFEBE9", "#D7CCC8", "#BCAAA4", "#A1887F", "#8D6E63", "#795548"
, "#6D4C41", "#5D4037", "#4E342E", "#3E2723"], | 1022 "#795548": ["#EFEBE9", "#D7CCC8", "#BCAAA4", "#A1887F", "#8D6E63", "#795548"
, "#6D4C41", "#5D4037", "#4E342E", "#3E2723"], |
| 1022 "#9E9E9E": ["#FAFAFA", "#F5F5F5", "#EEEEEE", "#E0E0E0", "#BDBDBD", "#9E9E9E"
, "#757575", "#616161", "#424242", "#212121"], | 1023 "#9E9E9E": ["#FAFAFA", "#F5F5F5", "#EEEEEE", "#E0E0E0", "#BDBDBD", "#9E9E9E"
, "#757575", "#616161", "#424242", "#212121"], |
| 1023 "#607D8B": ["#ECEFF1", "#CFD8DC", "#B0BEC5", "#90A4AE", "#78909C", "#607D8B"
, "#546E7A", "#455A64", "#37474F", "#263238"] | 1024 "#607D8B": ["#ECEFF1", "#CFD8DC", "#B0BEC5", "#90A4AE", "#78909C", "#607D8B"
, "#546E7A", "#455A64", "#37474F", "#263238"] |
| 1024 }; | 1025 }; |
| 1025 | 1026 |
| 1026 WebInspector.Spectrum.MaterialPalette = { title: "Material", mutable: false, mat
chUserFormat: true, colors: Object.keys(WebInspector.Spectrum.MaterialPaletteSha
des) }; | 1027 WebInspector.Spectrum.MaterialPalette = { title: "Material", mutable: false, mat
chUserFormat: true, colors: Object.keys(WebInspector.Spectrum.MaterialPaletteSha
des) }; |
| OLD | NEW |