scrawl-canvas
Version:
Version 8.9.4 - 19 Nov 2022
66 lines (50 loc) • 2.73 kB
HTML
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Demo Canvas 036</title>
<link href="css/normalize.css" rel="stylesheet" />
<link href="css/tests.css" rel="stylesheet" />
<style>
canvas {
background-color: lemonchiffon;
}
</style>
</head>
<body>
<h1><a href="index.html">Scrawl-canvas v8</a> - Canvas test 036</h1>
<h2>Cell artefact-like positional functionality</h2>
<h3>This canvas is resizable - drag the bottom right corner to change its dimensions. Also, Cells 4 and 5 are enabled for drag-and-drop</h3>
<div class="canvas-container">
<canvas
id="mycanvas"
data-scrawl-canvas
data-is-responsive="true"
data-base-background-color="honeydew"
></canvas>
</div>
<p id="reportmessage"></p>
<div class="testinfo">
<h4>Test purpose</h4>
<p>Test Cell functionality - specifically their artefact-like behaviour:</p>
<ul>
<li>Create a range of Cell artefacts with absolute and relative positioning and dimensions</li>
<li>Test that responsive Cell dimensions automatically update by dragging the visible <canvas> element's bottom right corner</li>
<li>Pivot an entity to a Cell; mimic an entity to a Cell</li>
<li>Pivot, mimic, path Cells to entitys</li>
<li>Animate the Cells - for instance: delta roll; animate along a path</li>
<li>Pivot a Cell to mouse cursor (tested separately in <a href="dom-011.html">Demo DOM-011</a>)</li>
<li>Collision detection - for instance emulating mouse hover over a Cell</li>
<li>Drag-and-drop a Cell across the canvas</li>
</ul>
<p>Note that the base Cell will stamp all entitys assigned to it as part of its <b>compile</b> step in the Display cycle, but additional Cells do not get stamped onto the base until the <b>show</b> step - thus additional Cells always stamp on top of base Cell entitys.</p>
<p>To give a Cell a <i>border</i>, add a Block entity and mimic it to the Cell - making sure it mimics the Cell's start, handle, dimensions, scale and rotation while also adding its own dimensions (twice the value of the required border). Or <i>vice versa</i> - both methods are tested in the code.</p>
<p>Hover effects, and drag-and-drop, functionality for Cells has to be 'emulated' by setting up a Block entity to perform these actions then getting the Cell to mimic/pivot the Block.</p>
<p><b>Touch test:</b> should work as expected</p>
<p><a href="../docs/demo/canvas-036.html">Annotated code</a></p>
</div>
<script src="canvas-036.js" type="module"></script>
</body>
</html>