@figspec/components
Advanced tools
Comparing version 0.1.10 to 1.0.0
import { LitElement } from "lit-element"; | ||
import { TouchGestureMixinProps } from "./TouchGestureMixin"; | ||
import type { Constructor } from "./utils"; | ||
@@ -12,2 +13,2 @@ export interface Positioned { | ||
} | ||
export declare const PositionedMixin: <T extends Constructor<LitElement>>(superClass: T) => T & Constructor<Positioned>; | ||
export declare const PositionedMixin: <T extends Constructor<LitElement>>(superClass: T) => T & Constructor<Positioned & TouchGestureMixinProps>; |
@@ -24,5 +24,6 @@ "use strict"; | ||
const lit_element_1 = require("lit-element"); | ||
const TouchGestureMixin_1 = require("./TouchGestureMixin"); | ||
exports.PositionedMixin = (superClass) => { | ||
var _isDragModeOn, _movePanel, _keyDown, _keyUp, _listenToKeyboardEvents; | ||
class Positioned extends superClass { | ||
class Positioned extends TouchGestureMixin_1.TouchGestureMixin(superClass) { | ||
constructor(...args) { | ||
@@ -163,2 +164,10 @@ super(...args); | ||
} | ||
onTouchPan(delta) { | ||
this.panX += delta.x / this.scale; | ||
this.panY += delta.y / this.scale; | ||
} | ||
onTouchPinch(delta) { | ||
// TODO: Remove this no-brainer magic number | ||
this.scale *= 1 - delta / 1000; | ||
} | ||
} | ||
@@ -165,0 +174,0 @@ _isDragModeOn = new WeakMap(), _movePanel = new WeakMap(), _keyDown = new WeakMap(), _keyUp = new WeakMap(), _listenToKeyboardEvents = new WeakMap(); |
@@ -298,4 +298,3 @@ "use strict"; | ||
node.type === "COMPONENT" || | ||
//@ts-ignore TODO: update types once there are updates in https://github.com/jongold/figma-js | ||
// See https://github.com/jongold/figma-js/pull/48 for the current state | ||
//@ts-ignore NOTE: figma-js does not implement COMPONENT_SET type (yet?) | ||
node.type === "COMPONENT_SET")) { | ||
@@ -302,0 +301,0 @@ throw new Error("Cannot update node tree: Top level node MUST be one of CANVAS, FRAME, COMPONENT, or COMPONENT_SET"); |
import { LitElement } from "lit-element"; | ||
import { TouchGestureMixinProps } from "./TouchGestureMixin"; | ||
import type { Constructor } from "./utils"; | ||
@@ -12,2 +13,2 @@ export interface Positioned { | ||
} | ||
export declare const PositionedMixin: <T extends Constructor<LitElement>>(superClass: T) => T & Constructor<Positioned>; | ||
export declare const PositionedMixin: <T extends Constructor<LitElement>>(superClass: T) => T & Constructor<Positioned & TouchGestureMixinProps>; |
@@ -21,5 +21,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
import { property } from "lit-element"; | ||
import { TouchGestureMixin } from "./TouchGestureMixin"; | ||
export const PositionedMixin = (superClass) => { | ||
var _isDragModeOn, _movePanel, _keyDown, _keyUp, _listenToKeyboardEvents; | ||
class Positioned extends superClass { | ||
class Positioned extends TouchGestureMixin(superClass) { | ||
constructor(...args) { | ||
@@ -160,2 +161,10 @@ super(...args); | ||
} | ||
onTouchPan(delta) { | ||
this.panX += delta.x / this.scale; | ||
this.panY += delta.y / this.scale; | ||
} | ||
onTouchPinch(delta) { | ||
// TODO: Remove this no-brainer magic number | ||
this.scale *= 1 - delta / 1000; | ||
} | ||
} | ||
@@ -162,0 +171,0 @@ _isDragModeOn = new WeakMap(), _movePanel = new WeakMap(), _keyDown = new WeakMap(), _keyUp = new WeakMap(), _listenToKeyboardEvents = new WeakMap(); |
@@ -295,4 +295,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
node.type === "COMPONENT" || | ||
//@ts-ignore TODO: update types once there are updates in https://github.com/jongold/figma-js | ||
// See https://github.com/jongold/figma-js/pull/48 for the current state | ||
//@ts-ignore NOTE: figma-js does not implement COMPONENT_SET type (yet?) | ||
node.type === "COMPONENT_SET")) { | ||
@@ -299,0 +298,0 @@ throw new Error("Cannot update node tree: Top level node MUST be one of CANVAS, FRAME, COMPONENT, or COMPONENT_SET"); |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "0.1.10", | ||
"version": "1.0.0", | ||
"contributors": [ | ||
@@ -11,0 +11,0 @@ { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
290123
95
7806
1