Skip to content

Commit 9fe4458

Browse files
committed
fixed wrong filte function
1 parent 679f62b commit 9fe4458

27 files changed

+91
-219
lines changed

dist/colorpicker.js

Lines changed: 33 additions & 165 deletions
Large diffs are not rendered by default.

dist/colorpicker.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@easylogic/colorpicker",
3-
"version": "1.9.68",
3+
"version": "1.9.69",
44
"description": "simple colorpicker used anywhere",
55
"main": "./dist/colorpicker.js",
66
"scripts": {

src/util/filter/functions.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,17 @@ export function makeUserFilterFunctionList (arr) {
374374
return [newKeys[key], JSON.stringify(it.context[key])].join(' = ')
375375
})
376376

377-
let preCallbackString = it.callback.toString().split("{");
377+
let preCallbackString = it.callback;
378378

379-
preCallbackString.shift()
380-
preCallbackString = preCallbackString.join("{")
381-
preCallbackString = preCallbackString.split("}")
382-
preCallbackString.pop()
383-
preCallbackString = preCallbackString.join("}")
379+
if (typeof it.callback === 'function') {
380+
preCallbackString = it.callback.toString().split("{");
381+
382+
preCallbackString.shift()
383+
preCallbackString = preCallbackString.join("{")
384+
preCallbackString = preCallbackString.split("}")
385+
preCallbackString.pop()
386+
preCallbackString = preCallbackString.join("}")
387+
}
384388

385389
Object.keys(newKeys).forEach(key => {
386390
var newKey = newKeys[key]

src/util/filter/pixel/bitonal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ export default function bitonal(darkColor, lightColor, threshold = 100) {
77
let $lightColor = Color.parse(lightColor);
88
let $threshold = threshold
99

10-
return pixel(() => {
10+
return pixel(`
1111
const thresholdColor = ( $r + $g + $b ) <= $threshold ? $darkColor : $lightColor
1212
1313
$r = thresholdColor.r;
1414
$g = thresholdColor.g;
1515
$b = thresholdColor.b;
16-
}, {
16+
`, {
1717
$threshold
1818
}, {
1919
$darkColor,

src/util/filter/pixel/brightness.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ export default function brightness (amount = 1) {
1111
amount = parseParamNumber(amount)
1212
const $C = Math.floor(255 * (amount / 100));
1313

14-
return pixel(() => {
14+
return pixel(`
1515
$r += $C;
1616
$g += $C;
1717
$b += $C;
18-
},{ $C })
18+
`,{ $C })
1919
}

src/util/filter/pixel/brownie.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ export default function brownie () {
1212
0,0,0,1
1313
]
1414

15-
return pixel(() => {
15+
return pixel(`
1616
$r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a;
1717
$g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a;
1818
$b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a;
1919
$a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a;
20-
}, {
20+
`, {
2121
$matrix
2222
})
2323
}

src/util/filter/pixel/clip.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ export default function clip (amount = 0) {
1111
amount = parseParamNumber(amount)
1212
const $C = Math.abs(amount) * 2.55
1313

14-
return pixel(() => {
14+
return pixel(`
1515
1616
$r = ($r > 255 - $C) ? 255 : 0;
1717
$g = ($g > 255 - $C) ? 255 : 0;
1818
$b = ($b > 255 - $C) ? 255 : 0;
1919
20-
}, { $C })
20+
`, { $C })
2121
}

src/util/filter/pixel/contrast.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export default function contrast(amount = 0) {
1010
amount = parseParamNumber(amount)
1111
const $C = Math.max((128 + amount) / 128, 0);
1212

13-
return pixel(() => {
13+
return pixel(`
1414
$r *= $C;
1515
$g *= $C;
1616
$b *= $C;
17-
}, { $C })
17+
`, { $C })
1818
}

src/util/filter/pixel/gamma.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import {
55

66
export default function gamma (amount = 1) {
77
const $C = parseParamNumber(amount)
8-
return pixel(() => {
8+
return pixel(`
99
$r = Math.pow($r / 255, $C) * 255;
1010
$g = Math.pow($g / 255, $C) * 255;
1111
$b = Math.pow($b / 255, $C) * 255;
12-
}, { $C })
12+
`, { $C })
1313
}

0 commit comments

Comments
 (0)