1.2.2 • Published 7 years ago

touchscreen-dnd-shim v1.2.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

About

This is a fork of a project by Tim Ruffles 'ios-html5-drag-drop-shim', instead of checking for certain user agents it just checks for the ability to create a touch event. Should work across more devices. Tested working in conjunction with ng2-dnd drag library.

Install

npm

npm install touchscreen-dnd-shim

Import CSS

@import "touchscreen-dnd-shim/default.css"

Import into component

import { polyfill } from 'touchscreen-dnd-shim';
...
@Component(...)
export class DragTestComponent implements OnInit {
  ...
  // constructor
  constructor() {
    polyfill({}); // options can be added, see docs for Tim Ruffles project
  }
  ...
  // prevent default on some drag events on dnd-droppable (important!)
  public preventDefault(event) {
    event.mouseEvent.preventDefault();
    return false;
  }
}

Add Directives to drop zones

<div dnd-droppable (onDragEnter)="preventDefault($event)" (onDragOver)="preventDefault($event)" (onDragLeave)="preventDefault($event)">
    draggables drop here
</div>
1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago