title: How to build a drag scenario using CSS or JS
body: <p>I'm trying to build a mechanic similar to this link <a href="https://demos.littleworkshop.fr/demos/infinitown/" rel="nofollow noreferrer">https://demos.littleworkshop.fr/demos/infinitown/</a>. Ignoring Three.JS's 3D features, I wish my user could drag the scene, this being an img tag or even a div with 3D transform, but the drag movement is just as smooth. How could I build this?</p>
  <p>My first attempt <a href="https://codepen.io/diogenesjup-the-encoder/pen/xxdEoEg" rel="nofollow noreferrer">https://codepen.io/diogenesjup-the-encoder/pen/xxdEoEg</a> almost worked, however, the 3D transform, left the parent DIV and the drag movement is not so fluid.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#square {
    position: absolute;
    display: block;
    top: 0;
    left: 0;
    width: 100px;
    height: 100px;
    background: #000;
    z-index: 9999;
    transform: rotateX( -70deg) rotateY( 14deg) rotateZ( 38deg) translateX(16px) translateY(-19px) translateZ(20px) scale(1) skewX( -19deg) skewY( 1deg);
    overflow: auto;
    transform-style: preserve-3d;
    box-shadow: rgb(249 249 251) 1px 1px 0px 1px, rgb(34 33 81 / 1%) -1px 0px 28px 0px, rgb(34 33 81 / 25%) 28px 28px 28px 0px;
  }
  
  #map {
    position: relative;
    left: 0;
    top: 0;
    width: 200px;
    height: auto;
    transform: rotateX( -70deg) rotateY( 14deg) rotateZ( 38deg) translateX(16px) translateY(-19px) translateZ(20px) scale(1) skewX( -19deg) skewY( 1deg);
    overflow: auto;
    transform-style: preserve-3d;
    box-shadow: rgb(249 249 251) 1px 1px 0px 1px, rgb(34 33 81 / 1%) -1px 0px 28px 0px, rgb(34 33 81 / 25%) 28px 28px 28px 0px;
  }</code></pre>
  </div>
  </div>
  </p>