How to use @swim/length - 10 common examples

To help you get started, we’ve selected a few @swim/length 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 swimos / swim / swim-js / swim-ui-js / @swim / view / main / attribute / LengthOrStringAttributeAnimator.ts View on Github external
let _this: LengthOrStringAttributeAnimator = function (value?: AnyLength | string | null, tween?: Tween): Length | string | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          if (typeof value === "string") {
            try {
              value = Length.parse(value, _this._view._node);
            } catch (swallow) {
              // string value
            }
          } else {
            value = Length.fromAny(value, _this._view._node);
          }
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as LengthOrStringAttributeAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / style / LengthOrStringStyleAnimator.ts View on Github external
let _this: LengthOrStringStyleAnimator = function (value?: AnyLength | string | null, tween?: Tween, priority?: string | null): Length | string | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          if (typeof value === "string") {
            try {
              value = Length.parse(value, _this._view._node);
            } catch (swallow) {
              // string value
            }
          } else {
            value = Length.fromAny(value, _this._view._node);
          }
        }
        _this.setState(value, tween, priority);
        return _this._view;
      }
    } as LengthOrStringStyleAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / style / LengthOrStringStyleAnimator.ts View on Github external
let _this: LengthOrStringStyleAnimator = function (value?: AnyLength | string | null, tween?: Tween, priority?: string | null): Length | string | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          if (typeof value === "string") {
            try {
              value = Length.parse(value, _this._view._node);
            } catch (swallow) {
              // string value
            }
          } else {
            value = Length.fromAny(value, _this._view._node);
          }
        }
        _this.setState(value, tween, priority);
        return _this._view;
      }
    } as LengthOrStringStyleAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / attribute / LengthAttributeAnimator.ts View on Github external
get: function (this: LengthAttributeAnimator): Length | null | undefined {
      let value = this._value;
      if (value === void 0) {
        const attributeValue = this.attributeValue;
        if (attributeValue) {
          try {
            value = Length.parse(attributeValue, this._view._node);
          } catch (swallow) {
            // nop
          }
        }
      }
      return value;
    },
    enumerable: true,
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / attribute / LengthOrStringAttributeAnimator.ts View on Github external
let _this: LengthOrStringAttributeAnimator = function (value?: AnyLength | string | null, tween?: Tween): Length | string | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          if (typeof value === "string") {
            try {
              value = Length.parse(value, _this._view._node);
            } catch (swallow) {
              // string value
            }
          } else {
            value = Length.fromAny(value, _this._view._node);
          }
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as LengthOrStringAttributeAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / style / LengthStyleAnimator.ts View on Github external
get: function (this: LengthStyleAnimator): Length | null | undefined {
      let value = this._value;
      if (value === void 0) {
        const propertyValue = this.propertyValue;
        if (propertyValue) {
          try {
            value = Length.parse(propertyValue, this._view._node);
          } catch (swallow) {
            // nop
          }
        }
      }
      return value;
    },
    enumerable: true,
github swimos / swim / swim-system-js / swim-ui-js / @swim / shape / main / ArcView.ts View on Github external
static from(innerRadius: AnyLength = Length.zero(),
              outerRadius: AnyLength = Length.zero(),
              startAngle: AnyAngle = Angle.zero(),
              sweepAngle: AnyAngle = Angle.zero(),
              padAngle: AnyAngle = Angle.zero(),
              padRadius: AnyLength | null = null,
              cornerRadius: AnyLength = Length.zero(),
              fill?: AnyColor | null,
              stroke?: AnyColor | null,
              strokeWidth?: AnyLength | null): ArcView {
    innerRadius = Length.fromAny(innerRadius);
    outerRadius = Length.fromAny(outerRadius);
    startAngle = Angle.fromAny(startAngle);
    sweepAngle = Angle.fromAny(sweepAngle);
    padAngle = Angle.fromAny(padAngle);
    padRadius = padRadius !== null ? Length.fromAny(padRadius) : null;
    cornerRadius = Length.fromAny(cornerRadius);
    const view = new ArcView(innerRadius, outerRadius, startAngle, sweepAngle,
                             padAngle, padRadius, cornerRadius);
    if (fill !== void 0) {
      view.fill(fill);
    }
    if (stroke !== void 0) {
      view.stroke(stroke);
    }
    if (strokeWidth !== void 0) {
      view.strokeWidth(strokeWidth);
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / member / LengthMemberAnimator.ts View on Github external
let _this: LengthMemberAnimator = function (value?: AnyLength | null, tween?: Tween): Length | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Length.fromAny(value);
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as LengthMemberAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / style / LengthStyleAnimator.ts View on Github external
let _this: LengthStyleAnimator = function (value?: AnyLength | null, tween?: Tween, priority?: string | null): Length | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Length.fromAny(value, view._node);
        }
        _this.setState(value, tween, priority);
        return _this._view;
      }
    } as LengthStyleAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / attribute / LengthAttributeAnimator.ts View on Github external
let _this: LengthAttributeAnimator = function (value?: AnyLength | null, tween?: Tween): Length | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Length.fromAny(value, _this._view._node);
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as LengthAttributeAnimator;
    (_this as any).__proto__ = this;

@swim/length

DOM-relative length types with unit-aware algebraic operators, conversions, and parsers

Apache-2.0
Latest version published 5 years ago

Package Health Score

59 / 100
Full package analysis