2025-10-27 20:51:17 +01:00
|
|
|
---
|
|
|
|
|
title: Drag
|
|
|
|
|
tags:
|
|
|
|
|
- ui
|
|
|
|
|
---
|
2026-04-23 21:45:14 +02:00
|
|
|
{% layout 'hippie-view/app.liquid' %}
|
2025-10-27 20:51:17 +01:00
|
|
|
|
|
|
|
|
{% block body %}
|
|
|
|
|
<header class="io pos_fix pin_top pin_right pin_left">
|
|
|
|
|
<button data-action="add">Add</button>
|
|
|
|
|
</header>
|
|
|
|
|
<div id="space"></div>
|
|
|
|
|
<div>
|
|
|
|
|
<div id="test">
|
|
|
|
|
<div class="body_frame">
|
2026-04-23 21:45:14 +02:00
|
|
|
{% render 'hippie-view/partials/frame-header.liquid' %}
|
2025-10-27 20:51:17 +01:00
|
|
|
<main></main>
|
2026-04-23 21:45:14 +02:00
|
|
|
{% render 'hippie-view/partials/frame-mode.liquid' %}
|
2025-10-27 20:51:17 +01:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
2026-03-10 21:21:08 +01:00
|
|
|
{% block assets %}
|
|
|
|
|
{{ block.super -}}
|
2026-02-21 12:58:31 +01:00
|
|
|
<script src="/js/drag.js"></script>
|
2026-03-10 21:21:08 +01:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
{%- block script %}
|
2025-10-27 20:51:17 +01:00
|
|
|
<script>
|
|
|
|
|
// Get the space element
|
|
|
|
|
const space = document.getElementById('space');
|
|
|
|
|
const add = document.querySelector('[data-action=add]');
|
|
|
|
|
const test = document.getElementById('test');
|
|
|
|
|
|
|
|
|
|
// Add event listener to the add space button
|
|
|
|
|
add.addEventListener('click', () => {
|
|
|
|
|
const newDiv = new NewDiv(100, 100, 100, 100, getRandomColor());
|
|
|
|
|
newDiv.createDiv();
|
|
|
|
|
newDiv.appendToFrame(space);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Create a new NewDiv instance
|
|
|
|
|
const newDiv = new NewDiv(100, 100, 200, 200, '#000');
|
|
|
|
|
newDiv.createDiv();
|
|
|
|
|
newDiv.appendToFrame(space);
|
|
|
|
|
|
|
|
|
|
const explorer = new NewDiv(256, 128, 800, 600, '#fff', test);
|
|
|
|
|
explorer.createDiv();
|
|
|
|
|
explorer.appendToFrame(space);
|
|
|
|
|
</script>
|
|
|
|
|
{% endblock %}
|