src/helpers/d3.colorPicker.js
File d3.colorPicker.js
has 419 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { isTouchDevice } from "base/utils";
const css = {
INVISIBLE: "vzb-invisible",
COLOR_POINTER: "vzb-colorpicker-pointer",
Function _initCircles
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_initCircles() {
const {
_svg,
_maxHeight,
_width,
ColorPicker
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export default class ColorPicker {
constructor(container) {
this._container = container;
this._wrapper = this._container.select("." + css.COLOR_PICKER);
Function fitToScreen
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
fitToScreen(arg) {
const screen = this._container.node().getBoundingClientRect();
let xPos, yPos;
const {
Function _initVariables
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_initVariables() {
// radius of the central hole in color wheel: px
this._maxWidth = 280;
this._maxHeight = 323;
Function _generateColorData
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
_generateColorData() {
const {
_minL,
_minH,
_nCellsL,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _generateColorData
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_generateColorData() {
const {
_minL,
_minH,
_nCellsL,
Function fitToScreen
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
fitToScreen(arg) {
const screen = this._container.node().getBoundingClientRect();
let xPos, yPos;
const {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function resize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
resize(arg) {
if (!arguments.length)
return;
if (typeof arg !== "undefined") {