|
|
@ -8,6 +8,7 @@ |
|
|
|
</head> |
|
|
|
<body> |
|
|
|
|
|
|
|
|
|
|
|
<div class="about"><a href="https://vvvvvvaria.org/logs/narrowcast/" target="_blank">back<span> ↗</span><br>↬ stage </a></div> |
|
|
|
|
|
|
|
<div id="side" class="sidebar sidemin"> |
|
|
@ -76,79 +77,75 @@ |
|
|
|
--> |
|
|
|
|
|
|
|
|
|
|
|
<p class="note"> * move and resize the elements above by dragging their corners and sides *</p> |
|
|
|
<p class="note"> * move and resize the elements above by dragging their corners / sides and click on the page to set the position *</p> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- button to hide side pannel --> |
|
|
|
|
|
|
|
<script type="text/javascript"> |
|
|
|
|
|
|
|
function fside() { |
|
|
|
var element = document.getElementById("side"); |
|
|
|
element.classList.toggle("sideminclicked"); |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<!-- drag and resize library: https://interactjs.io/docs/installation#cdn-streamlined --> |
|
|
|
<script src="interact.min.js"></script> |
|
|
|
<!-- script above same as <script src="https://cdnjs.cloudflare.com/ajax/libs/interact.js/1.2.6/interact.min.js"></script> --> |
|
|
|
|
|
|
|
<!-- also found this other options: |
|
|
|
https://www.webcomponents.org/element/jifalops/drag-resize |
|
|
|
https://codepen.io/zz85/pen/gbOoVP --> |
|
|
|
|
|
|
|
<script> |
|
|
|
interact('.resize-drag') |
|
|
|
.draggable({ |
|
|
|
onmove: window.dragMoveListener |
|
|
|
}) |
|
|
|
.resizable({ |
|
|
|
preserveAspectRatio: true, |
|
|
|
edges: { left: true, right: true, bottom: true, top: true } |
|
|
|
}) |
|
|
|
.on('resizemove', function (event) { |
|
|
|
var target = event.target, |
|
|
|
x = (parseFloat(target.getAttribute('data-x')) || 0), |
|
|
|
y = (parseFloat(target.getAttribute('data-y')) || 0); |
|
|
|
|
|
|
|
// update the element's style |
|
|
|
target.style.width = event.rect.width + 'px'; |
|
|
|
target.style.height = event.rect.height + 'px'; |
|
|
|
|
|
|
|
// translate when resizing from top or left edges |
|
|
|
x += event.deltaRect.left; |
|
|
|
y += event.deltaRect.top; |
|
|
|
|
|
|
|
target.style.webkitTransform = target.style.transform = |
|
|
|
'translate(' + x + 'px,' + y + 'px)'; |
|
|
|
|
|
|
|
target.setAttribute('data-x', x); |
|
|
|
target.setAttribute('data-y', y); |
|
|
|
target.textContent = event.rect.width + '×' + event.rect.height; |
|
|
|
}); |
|
|
|
|
|
|
|
function dragMoveListener (event) { |
|
|
|
var target = event.target, |
|
|
|
// keep the dragged position in the data-x/data-y attributes |
|
|
|
x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx, |
|
|
|
y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy; |
|
|
|
|
|
|
|
// translate the element |
|
|
|
target.style.webkitTransform = |
|
|
|
target.style.transform = |
|
|
|
'translate(' + x + 'px, ' + y + 'px)'; |
|
|
|
|
|
|
|
<!-- BBUTTON HIDE side pannel --> |
|
|
|
|
|
|
|
<script type="text/javascript"> |
|
|
|
|
|
|
|
function fside() { |
|
|
|
var element = document.getElementById("side"); |
|
|
|
element.classList.toggle("sideminclicked"); |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<!-- DRAG and RESIZE library --> |
|
|
|
|
|
|
|
<!-- source: https://interactjs.io/docs/installation#cdn-streamlined --> |
|
|
|
<script src="interact.min.js"></script> |
|
|
|
<!-- script above same as https://cdnjs.cloudflare.com/ajax/libs/interact.js/1.2.6/interact.min.js --> |
|
|
|
|
|
|
|
<!-- also found this other options: |
|
|
|
https://www.webcomponents.org/element/jifalops/drag-resize |
|
|
|
https://codepen.io/zz85/pen/gbOoVP --> |
|
|
|
|
|
|
|
<script> |
|
|
|
interact('.resize-drag') |
|
|
|
.draggable({ |
|
|
|
onmove: window.dragMoveListener |
|
|
|
}) |
|
|
|
.resizable({ |
|
|
|
preserveAspectRatio: true, |
|
|
|
edges: { left: true, right: true, bottom: true, top: true } |
|
|
|
}) |
|
|
|
.on('resizemove', function (event) { |
|
|
|
var target = event.target, |
|
|
|
x = (parseFloat(target.getAttribute('data-x')) || 0), |
|
|
|
y = (parseFloat(target.getAttribute('data-y')) || 0); |
|
|
|
|
|
|
|
// update the element's style |
|
|
|
target.style.width = event.rect.width + 'px'; |
|
|
|
target.style.height = event.rect.height + 'px'; |
|
|
|
|
|
|
|
// translate when resizing from top or left edges |
|
|
|
x += event.deltaRect.left; |
|
|
|
y += event.deltaRect.top; |
|
|
|
|
|
|
|
target.style.webkitTransform = target.style.transform = |
|
|
|
'translate(' + x + 'px,' + y + 'px)'; |
|
|
|
|
|
|
|
target.setAttribute('data-x', x); |
|
|
|
target.setAttribute('data-y', y); |
|
|
|
target.textContent = event.rect.width + '×' + event.rect.height; |
|
|
|
}); |
|
|
|
|
|
|
|
function dragMoveListener (event) { |
|
|
|
var target = event.target, |
|
|
|
// keep the dragged position in the data-x/data-y attributes |
|
|
|
x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx, |
|
|
|
y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy; |
|
|
|
|
|
|
|
// translate the element |
|
|
|
target.style.webkitTransform = |
|
|
|
target.style.transform = |
|
|
|
'translate(' + x + 'px, ' + y + 'px)'; |
|
|
|
|
|
|
|
// update the posiion attributes |
|
|
|
target.setAttribute('data-x', x); |
|
|
|
target.setAttribute('data-y', y); |
|
|
|
} |
|
|
|
</script> |
|
|
|
// update the posiion attributes |
|
|
|
target.setAttribute('data-x', x); |
|
|
|
target.setAttribute('data-y', y); |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
</body> |
|
|
|