1.0.11 • Published 3 years ago

@domodel/resizable v1.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

domodel-resizable

Resizable system for domodel.

Getting started

Installing

  • npm install @domodel/resizable

Usage

src/model/image.js

export default {
  tagName: "div",
  style: "position: relative; display: inline-block",
  children: [
    {
      tagName: "img",
      style: "width: 100%; height: 100%",
      src: "yourimageurl"
    }
  ]
}

src/binding/image.js

import { Core, Observable, Binding } from "domodel"
import { Resizable, ResizableModel, ResizableBinding } from "@domodel/resizable"

export default class extends Binding {

  onCreated() {

    const resizable = new Resizable()

    this.listen(resizable, "size set", data => {
      this.root.style.width = data.width + "px"
      this.root.style.height = data.height + "px"
    })

    Core.run(ResizableModel, { binding: new ResizableBinding({ resizable, preview: true, directions: ["horizontal", "vertical", "diagonal"] }) })

  }

}
1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago