Socket
Socket
Sign inDemoInstall

aframe-drag-controls

Package Overview
Dependencies
37
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    aframe-drag-controls

A wrapper for THREE.DragControls.


Version published
Weekly downloads
7
increased by250%
Maintainers
1
Install size
6.26 kB
Created
Weekly downloads
 

Readme

Source

aframe-drag-controls

A wrapper for THREE.DragControls.

setup

npm

npm i aframe-drag-controls

import AFRAME from 'aframe';
import 'aframe-drag-controls';

browser

<script src="https://unpkg.com/aframe"></script>
<script src="https://unpkg.com/aframe-drag-controls"></script>

usage

<a-scene>
  <a-entity
    camera
    drag-controls="objects: .draggable"
    look-controls
    orbit-controls="initialPosition: 0 5 15"
  ></a-entity>
  <a-box
    class="draggable"
  ></a-box>
</a-scene>
let sceneEl = document.querySelector('a-scene');
{
  let el = sceneEl.querySelector('[camera]');
  el.addEventListener('drag-controls:changed', event => {
    event.target.setAttribute('orbit-controls', 'enabled', !event.detail.active);
  });
}
{
  let onDragStart = (event => {
    event.target.setAttribute('color', 'DeepSkyBlue');
  });
  let onDragEnd = (event => {
    event.target.removeAttribute('color');
  });
  let els = sceneEl.querySelectorAll('a-box.draggable');
  for (let el of els) {
    el.addEventListener('dragstart', onDragStart);
    el.addEventListener('dragend', onDragEnd);
  }
}

properties

nametypedefault
enabled'boolean'true
objects'string''*'

events

name
drag-controls:changed

Keywords

FAQs

Last updated on 02 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc