Skip to content

Commit

Permalink
similar updateDisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
frost-nzcr4 committed Apr 24, 2011
1 parent 7b21f70 commit ce57a16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/1/farbtastic.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@
*/
fb.updateDisplay = function () {
// Determine whether labels/markers should invert
fb.invert = fb.hsl[2] <= 0.5;
// :old: fb.invert = fb.hsl[2] <= 0.5;
fb.invert = (fb.rgb[0] * 0.3 + fb.rgb[1] * 0.59 + fb.rgb[2] * 0.11) <= 0.6;

// Saturation/Luminance gradient
// Update the solid background fill
fb.solidFill.css("backgroundColor", $.farbtastic.colorUtilities.pack($.farbtastic.colorUtilities.HSLToRGB([fb.hsl[0], 1, 0.5])));

// Draw markers
Expand Down Expand Up @@ -177,7 +178,8 @@
}

// Update the stored offset for the widget
fb.offset = $(fb.wheel).offset();
fb.offset = element.offset();
// fb.offset = $(fb.wheel).offset();

// Check which area is being dragged
var pos = $.farbtastic.widgetCoords(fb, event);
Expand Down
4 changes: 3 additions & 1 deletion src/2/farbtastic.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@
*/
fb.updateDisplay = function () {
// Determine whether labels/markers should invert
// :old: fb.invert = fb.hsl[2] <= 0.5;
fb.invert = (fb.rgb[0] * 0.3 + fb.rgb[1] * 0.59 + fb.rgb[2] * 0.11) <= 0.6;

// Update the solid background fill
Expand Down Expand Up @@ -379,7 +380,8 @@
}

// Update the stored offset for the widget
fb.offset = $(container).offset();
fb.offset = element.offset();
// fb.offset = $(container).offset();

// Check which area is being dragged
var pos = $.farbtastic.widgetCoords(fb, event);
Expand Down

0 comments on commit ce57a16

Please sign in to comment.