Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// create initial markers
const $leftMarker = this.createMarker({
color: 'white',
percent: 0,
index: 0
})
const $rightMarker = this.createMarker({
color: 'black',
percent: 100,
index: 1
})
this.markers.push(
getData('value', $leftMarker),
getData('value', $rightMarker)
)
this.selectMarker($rightMarker)
this.actionBarSize = getData('value', $leftMarker).maxLenght
// initial wheel
this.WHEEL = new Wheel(this.instance, this.$wheel)
}
bind() {
children(this.$trigger).forEach(($this, i) => {
const $content = children(this.$container)[i]
removeClass(this.classes.SELECTED, $this)
hideElement($content)
this.leave(`${getData('type', $this)}Module`)
if (getData('type', $this) === typeName) {
addClass(this.classes.SELECTED, $this)
$content.style.display = 'block'
// showElement($content)
}
})
({ target: $this }) => {
if (getData('type', $this) !== 'gradient') {
this.markers.map((marker, i) => { /* eslint-disable-line */
const $item = marker.$el
if (hasClass(this.classes.MARKERACTIVE, $item)) {
this.lastActiveMarkerIndex = i
}
})
}
},
this.instance.$panel
children() {
const children = []
let node
for (let i = 0; i < this.subelements.length; i++) {
node = getData('node', this.subelements[i])
if (node) {
children.push(node)
}
}
return children
}
({ target: $this }) => {
if (
this.markers.length <= 2 ||
!hasClass(this.classes.DELETEACTIVE, $this)
) {
return false
}
const $marker = this.$marker
const index = getData('value', $marker).index
$marker.remove()
removeClass(this.classes.DELETEACTIVE, this.$delete)
this.markers.splice(index, 1)
this.GRADIENT.removeById(index)
this.sort()
this.GRADIENT.reorder()
this.update(false)
this.leave('SelectedMarker')
return null
},
this.$handle
verification() {
if (this.element.tagName.toLowerCase() === 'input') {
if (getData('min', this.element) || getData('min', this.element) === 0) {
const m = getData('min', this.element)
const n = Number(m)
if (n >= this.options.max) {
this.options.min = 0
}
}
if (getData('max', this.element) || getData('max', this.element) === 0) {
const m = getData('max', this.element)
const n = Number(m)
if (n <= 0) {
this.options.max = 2
}
}
}
}
update() {
if (this.instance.is('gradientModule')) {
if (this.instance.is('SelectedMarker')) {
this.instance.GRADIENT.setGradientColor(
{
s: this.positionX / this.maxLengthX,
v: 1 - this.positionY / this.maxLengthY
},
getData('value', this.instance.$marker).index
)
}
} else {
this.instance.SOLID.setSolid({
s: this.positionX / this.maxLengthX,
v: 1 - this.positionY / this.maxLengthY
})
}
}
}
detectService() {
let service = getData('service', this.element)
if (!service) {
service = Object.keys(SERVICES).filter(service => {
return this.element.className.indexOf(service) >= 0
})[0]
}
if (service) {
this.service = service
setData('service', service, this.element)
}
}