From 9070c71e9fc769cbfd944c09cf70eccd87f8f7b1 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 8 Feb 2021 11:01:27 +0000 Subject: [PATCH] color picker: allow full white --- src/static/js/farbtastic.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/static/js/farbtastic.js b/src/static/js/farbtastic.js index 78edcd094..c6e12da44 100644 --- a/src/static/js/farbtastic.js +++ b/src/static/js/farbtastic.js @@ -5,9 +5,9 @@ // https://github.com/mattfarina/farbtastic/blob/71ca15f4a09c8e5a08a1b0d1cf37ef028adf22f0/LICENSE.txt // edited by Sebastian Castro on 2020-04-06 (function ($) { - + var __debug = false; -var __factor = 0.8; +var __factor = 1; $.fn.farbtastic = function (options) { $.farbtastic(this, options); @@ -21,7 +21,7 @@ $.farbtastic = function (container, options) { $._farbtastic = function (container, options) { var fb = this; - + ///////////////////////////////////////////////////// /** @@ -141,7 +141,7 @@ $._farbtastic = function (container, options) { fb.ctxOverlay = fb.cnvOverlay[0].getContext('2d'); fb.ctxMask.translate(fb.mid, fb.mid); fb.ctxOverlay.translate(fb.mid, fb.mid); - + // Draw widget base layers. fb.drawCircle(); fb.drawMask(); @@ -215,7 +215,7 @@ $._farbtastic = function (container, options) { m.restore(); __debug && $('body').append('
drawCircle '+ (+(new Date()) - tm) +'ms'); }; - + /** * Draw the saturation/luminance mask. */ @@ -239,9 +239,9 @@ $._farbtastic = function (container, options) { outputPixel(x, y, c, a); } - } + } } - + // Method #1: direct pixel access (new Canvas). if (fb.ctxMask.getImageData) { // Create half-resolution buffer. @@ -302,7 +302,7 @@ $._farbtastic = function (container, options) { } cache.push([c, a]); }); - } + } __debug && $('body').append('
drawMask '+ (+(new Date()) - tm) +'ms'); } @@ -348,7 +348,7 @@ $._farbtastic = function (container, options) { // Draw markers fb.drawMarkers(); - + // Linked elements or callback if (typeof fb.callback == 'object') { // Set background/foreground color @@ -368,15 +368,15 @@ $._farbtastic = function (container, options) { fb.callback.call(fb, fb.color); } } - + /** * Helper for returning coordinates relative to the center. */ fb.widgetCoords = function (event) { return { - x: event.pageX - fb.offset.left - fb.mid, + x: event.pageX - fb.offset.left - fb.mid, y: event.pageY - fb.offset.top - fb.mid - }; + }; } /** @@ -439,7 +439,7 @@ $._farbtastic = function (container, options) { fb.packDX = function (c, a) { return '#' + fb.dec2hex(a) + fb.dec2hex(c) + fb.dec2hex(c) + fb.dec2hex(c); }; - + fb.pack = function (rgb) { var r = Math.round(rgb[0] * 255); var g = Math.round(rgb[1] * 255);