How to use the @pluginjs/utils.convertPercentageToFloat function in @pluginjs/utils

To help you get started, we’ve selected a few @pluginjs/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pluginjs / pluginjs / modules / scrollable / src / main.js View on Github external
scrollBy(direction, value, trigger, sync) {
    let type = typeof value

    if (type === 'string') {
      if (isPercentage(value)) {
        value =
          convertPercentageToFloat(value) * this.getScrollLength(direction)
      }

      value = parseFloat(value)
      type = 'number'
    }

    if (type !== 'number') {
      return
    }

    this.move(direction, this.getOffset(direction) + value, trigger, sync)
  }
github pluginjs / pluginjs / modules / scrollable / src / main.js View on Github external
scrollTo(direction, value, trigger, sync) {
    let type = typeof value

    if (type === 'string') {
      if (isPercentage(value)) {
        value =
          convertPercentageToFloat(value) * this.getScrollLength(direction)
      }

      value = parseFloat(value)
      type = 'number'
    }

    if (type !== 'number') {
      return
    }

    this.move(direction, value, trigger, sync)
  }
github pluginjs / pluginjs / modules / color / src / colorStrings.js View on Github external
parse(result) {
      const hsla = {
        h: ((result[1] % 360) + 360) % 360,
        s: isPercentage(result[2])
          ? convertPercentageToFloat(result[2])
          : parseFloat(result[2], 10),
        l: isPercentage(result[3])
          ? convertPercentageToFloat(result[3])
          : parseFloat(result[3], 10),
        a: isPercentage(result[4])
          ? convertPercentageToFloat(result[4])
          : parseFloat(result[4], 10)
      }

      return Converter.HSLtoRGB(hsla)
    },
    to(color) {
github pluginjs / pluginjs / modules / scrollbar / src / main.js View on Github external
moveBy(value, trigger, sync) {
    let type = typeof value

    if (type === 'string') {
      if (isPercentage(value)) {
        value =
          convertPercentageToFloat(value) * (this.barLength - this.handleLength)
      }

      value = parseFloat(value)
      type = 'number'
    }

    if (type !== 'number') {
      return
    }

    this.move(this.handlePosition + value, trigger, sync)
  }
github pluginjs / pluginjs / modules / color / src / colorStrings.js View on Github external
parse(result) {
      const hsla = {
        h: ((result[1] % 360) + 360) % 360,
        s: isPercentage(result[2])
          ? convertPercentageToFloat(result[2])
          : parseFloat(result[2], 10),
        l: isPercentage(result[3])
          ? convertPercentageToFloat(result[3])
          : parseFloat(result[3], 10),
        a: isPercentage(result[4])
          ? convertPercentageToFloat(result[4])
          : parseFloat(result[4], 10)
      }

      return Converter.HSLtoRGB(hsla)
    },
    to(color) {
github pluginjs / pluginjs / modules / color / src / colorStrings.js View on Github external
parse(result) {
      const hsla = {
        h: ((result[1] % 360) + 360) % 360,
        s: isPercentage(result[2])
          ? convertPercentageToFloat(result[2])
          : parseFloat(result[2], 10),
        l: isPercentage(result[3])
          ? convertPercentageToFloat(result[3])
          : parseFloat(result[3], 10),
        a: isPercentage(result[4])
          ? convertPercentageToFloat(result[4])
          : parseFloat(result[4], 10)
      }

      return Converter.HSLtoRGB(hsla)
    },
    to(color) {