@radial-color-picker/color-wheel
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -0,1 +1,9 @@ | ||
/** | ||
* radial-color-picker/color-wheel v2.0.0 | ||
* | ||
* https://github.com/radial-color-picker/color-wheel | ||
* | ||
* Copyright (c) 2018-present, Rosen Kanev | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
@@ -15,13 +23,13 @@ | ||
function paintColorWheelToCanvas(canvas, size) { | ||
var half = size / 2; | ||
var radius = Math.sqrt(2) * half; | ||
var deg = Math.PI / 180; | ||
var pi2 = Math.PI * 2; | ||
const half = size / 2; | ||
const radius = Math.sqrt(2) * half; | ||
const deg = Math.PI / 180; | ||
const pi2 = Math.PI * 2; | ||
canvas.width = canvas.height = size; | ||
var ctx = canvas.getContext('2d'); | ||
const ctx = canvas.getContext('2d'); | ||
// .02: To prevent empty blank line and corresponding moire | ||
// only non-alpha colors are cared now | ||
var thetaOffset = 0.5 * deg + 0.02; | ||
const thetaOffset = 0.5 * deg + 0.02; | ||
@@ -33,9 +41,9 @@ // Transform coordinate system so that angles start from the top left, like in CSS | ||
for (var i = 0; i < 360; i += 0.5) { | ||
ctx.fillStyle = 'hsl(' + i + ', 100%, 50%)'; | ||
for (let i = 0; i < 360; i += 0.5) { | ||
ctx.fillStyle = `hsl(${i}, 100%, 50%)`; | ||
ctx.beginPath(); | ||
ctx.moveTo(half, half); | ||
var beginArg = i * deg; | ||
var endArg = Math.min(pi2, beginArg + thetaOffset); | ||
const beginArg = i * deg; | ||
const endArg = Math.min(pi2, beginArg + thetaOffset); | ||
@@ -42,0 +50,0 @@ ctx.arc(half, half, radius, beginArg, endArg); |
/** | ||
* radial-color-picker/color-wheel v2.0.0 | ||
* | ||
* https://github.com/radial-color-picker/color-wheel | ||
* | ||
* Copyright (c) 2018-present, Rosen Kanev | ||
* Released under the MIT License. | ||
*/ | ||
/** | ||
* Modified version of Lea Verou's | ||
@@ -13,13 +21,13 @@ * {@link https://github.com/leaverou/conic-gradient conic-gradient}. | ||
function paintColorWheelToCanvas(canvas, size) { | ||
var half = size / 2; | ||
var radius = Math.sqrt(2) * half; | ||
var deg = Math.PI / 180; | ||
var pi2 = Math.PI * 2; | ||
const half = size / 2; | ||
const radius = Math.sqrt(2) * half; | ||
const deg = Math.PI / 180; | ||
const pi2 = Math.PI * 2; | ||
canvas.width = canvas.height = size; | ||
var ctx = canvas.getContext('2d'); | ||
const ctx = canvas.getContext('2d'); | ||
// .02: To prevent empty blank line and corresponding moire | ||
// only non-alpha colors are cared now | ||
var thetaOffset = 0.5 * deg + 0.02; | ||
const thetaOffset = 0.5 * deg + 0.02; | ||
@@ -31,9 +39,9 @@ // Transform coordinate system so that angles start from the top left, like in CSS | ||
for (var i = 0; i < 360; i += 0.5) { | ||
ctx.fillStyle = 'hsl(' + i + ', 100%, 50%)'; | ||
for (let i = 0; i < 360; i += 0.5) { | ||
ctx.fillStyle = `hsl(${i}, 100%, 50%)`; | ||
ctx.beginPath(); | ||
ctx.moveTo(half, half); | ||
var beginArg = i * deg; | ||
var endArg = Math.min(pi2, beginArg + thetaOffset); | ||
const beginArg = i * deg; | ||
const endArg = Math.min(pi2, beginArg + thetaOffset); | ||
@@ -40,0 +48,0 @@ ctx.arc(half, half, radius, beginArg, endArg); |
@@ -0,1 +1,9 @@ | ||
/** | ||
* radial-color-picker/color-wheel v2.0.0 | ||
* | ||
* https://github.com/radial-color-picker/color-wheel | ||
* | ||
* Copyright (c) 2018-present, Rosen Kanev | ||
* Released under the MIT License. | ||
*/ | ||
(function (global, factory) { | ||
@@ -19,34 +27,28 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
function paintColorWheelToCanvas(canvas, size) { | ||
var half = size / 2; | ||
var radius = Math.sqrt(2) * half; | ||
var deg = Math.PI / 180; | ||
var pi2 = Math.PI * 2; | ||
var half = size / 2; | ||
var radius = Math.sqrt(2) * half; | ||
var deg = Math.PI / 180; | ||
var pi2 = Math.PI * 2; | ||
canvas.width = canvas.height = size; | ||
var ctx = canvas.getContext('2d'); // .02: To prevent empty blank line and corresponding moire | ||
// only non-alpha colors are cared now | ||
canvas.width = canvas.height = size; | ||
var ctx = canvas.getContext('2d'); | ||
var thetaOffset = 0.5 * deg + 0.02; // Transform coordinate system so that angles start from the top left, like in CSS | ||
// .02: To prevent empty blank line and corresponding moire | ||
// only non-alpha colors are cared now | ||
var thetaOffset = 0.5 * deg + 0.02; | ||
ctx.translate(half, half); | ||
ctx.rotate(-Math.PI / 2); | ||
ctx.translate(-half, -half); | ||
// Transform coordinate system so that angles start from the top left, like in CSS | ||
ctx.translate(half, half); | ||
ctx.rotate(-Math.PI / 2); | ||
ctx.translate(-half, -half); | ||
for (var i = 0; i < 360; i += 0.5) { | ||
ctx.fillStyle = "hsl(" + i + ", 100%, 50%)"; | ||
ctx.beginPath(); | ||
ctx.moveTo(half, half); | ||
var beginArg = i * deg; | ||
var endArg = Math.min(pi2, beginArg + thetaOffset); | ||
ctx.arc(half, half, radius, beginArg, endArg); | ||
ctx.closePath(); | ||
ctx.fill(); | ||
} | ||
for (var i = 0; i < 360; i += 0.5) { | ||
ctx.fillStyle = 'hsl(' + i + ', 100%, 50%)'; | ||
ctx.beginPath(); | ||
ctx.moveTo(half, half); | ||
var beginArg = i * deg; | ||
var endArg = Math.min(pi2, beginArg + thetaOffset); | ||
ctx.arc(half, half, radius, beginArg, endArg); | ||
ctx.closePath(); | ||
ctx.fill(); | ||
} | ||
return canvas; | ||
return canvas; | ||
} | ||
@@ -53,0 +55,0 @@ |
@@ -1,1 +0,9 @@ | ||
!function(a,b){typeof exports==='object'&&typeof module!=='undefined'?module.exports=b():typeof define==='function'&&define.amd?define(b):(a.colorWheel=b())}(this,(function(){'use strict';function a(a,b){var c=b/2,d=Math.sqrt(2)*c,e=Math.PI/180,f=Math.PI*2;a.width=a.height=b;var g=a.getContext('2d'),h=0.5*e+0.02;g.translate(c,c);g.rotate(-Math.PI/2);g.translate(-c,-c);for(var i=0;i<360;i+=0.5){g.fillStyle='hsl('+i+', 100%, 50%)';g.beginPath();g.moveTo(c,c);var j=i*e,k=Math.min(f,j+h);g.arc(c,c,d,j,k);g.closePath();g.fill()}return a}return a})) | ||
/** | ||
* radial-color-picker/color-wheel v2.0.0 | ||
* | ||
* https://github.com/radial-color-picker/color-wheel | ||
* | ||
* Copyright (c) 2018-present, Rosen Kanev | ||
* Released under the MIT License. | ||
*/ | ||
(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.colorWheel=b()})(this,function(){"use strict";return function(a,b){var c=Math.PI,d=b/2,e=Math.sqrt(2)*d,f=c/180;a.width=a.height=b;var g=a.getContext("2d");g.translate(d,d),g.rotate(-c/2),g.translate(-d,-d);for(var h=0;360>h;h+=.5){g.fillStyle="hsl("+h+", 100%, 50%)",g.beginPath(),g.moveTo(d,d);var j=h*f,k=Math.min(2*c,j+(.5*f+.02));g.arc(d,d,e,j,k),g.closePath(),g.fill()}return a}}); |
{ | ||
"name": "@radial-color-picker/color-wheel", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Minimal, framework-agnostic companion plugin for managing the color wheel of the Radial Color Picker.", | ||
@@ -10,11 +10,20 @@ "main": "dist/color-wheel.cjs.js", | ||
"devDependencies": { | ||
"babel-core": "6.26.3", | ||
"babel-preset-env": "1.6.1", | ||
"rollup": "0.63.4", | ||
"rollup-plugin-babel": "3.0.7", | ||
"rollup-plugin-butternut": "0.1.0" | ||
"@babel/core": "7.1.6", | ||
"@babel/preset-env": "7.1.6", | ||
"babel-core": "7.0.0-bridge.0", | ||
"babel-jest": "23.6.0", | ||
"canvas": "2.1.0", | ||
"jest": "23.6.0", | ||
"prettier": "1.15.2", | ||
"rollup": "0.67.3", | ||
"rollup-plugin-babel": "4.0.3", | ||
"rollup-plugin-babel-minify": "6.1.1" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c", | ||
"dev": "rollup -c -w" | ||
"dev": "rollup -c -w", | ||
"lint": "prettier --write \"**/*.js\"", | ||
"test": "jest", | ||
"ci": "jest -i --ci -b", | ||
"prepublishOnly": "rollup -c" | ||
}, | ||
@@ -21,0 +30,0 @@ "files": [ |
@@ -13,2 +13,5 @@ ## Radial Color Picker - Color Wheel | ||
</a> | ||
<a href="https://circleci.com/gh/radial-color-picker/color-wheel"> | ||
<img src="https://circleci.com/gh/radial-color-picker/color-wheel.svg?style=shield" alt="CircleCI"> | ||
</a> | ||
</p> | ||
@@ -15,0 +18,0 @@ |
10287
153
63
10