qt-example.js

total 0
used 0
limit 0
/* title: Linear Arrangement categories: arrange files: head stage point pointlist dragging stroke mouse ../point_src/random.js ../theatre/qt-rectangle.js ../theatre/qt-quadtree.js */ let boundary = new Rectangle(340, 340, 300, 300); qtree = new QuadTree(boundary, 4); class MainStage extends Stage { canvas = 'playspace' mounted() { this.reset() } reset() { this.points = PointList.generate.random(2000, 600, [100,100, 1]) qtree.clear() this.points.forEach(p=>qtree.insert(p)) } onMousedown(ev) { let p = Point.from(ev) qtree.insert(p); this.points.push(p) } draw(ctx) { this.clear(ctx); this.points.pen.circle(ctx, undefined, 'red') draw(ctx, this.mouse.point) } } function draw(ctx, mouse) { ctx.strokeStyle = 'orange' qtree.show(ctx); ctx.stroke() // rectMode(CENTER); let range = new Rectangle(mouse.x, mouse.y, 50, 50); let found = qtree.query(range); ctx.strokeStyle = 'green' let hw = range.w let hh = range.h ctx.rect(range.x - hw , range.y - hh , range.w * 2 , range.h * 2) ctx.stroke() found.pen.circle(ctx, undefined, 'yellow') } stage = MainStage.go()
Run
Meta Data
title Linear Arrangement
imports ()
files ('head', 'stage', 'point', 'pointlist', 'dragging', 'stroke', 'mouse', '../point_src/random.js', '../theatre/qt-rectangle.js', '../theatre/qt-quadtree.js')
unused_keys ()
unknown_keys ('categories',)
categories ['arrange']
filepath_exists True
path qt-example.js
filepath qt-example.js
clean_files ('../point_src/core/head.js', '../point_src/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/pointpen.js', '../point_src/compass.js', '../point_src/center.js', '../point_src/point-content.js', '../point_src/pointdraw.js', '../point_src/relative-xy.js', '../point_src/pointcast.js', '../point_src/point.js', '../point_src/pointlistdraw.js', '../point_src/pointlistgradient.js', '../point_src/pointlistshape.js', '../point_src/pointlistgenerator.js', '../point_src/unpack.js', '../point_src/pointlist.js', '../point_src/pointlistpen.js', '../point_src/functions/clamp.js', '../point_src/distances.js', '../point_src/protractor.js', '../point_src/text/beta.js', '../point_src/dragging.js', '../point_src/setunset.js', '../point_src/stroke.js', '../point_src/events.js', '../point_src/automouse.js', '../point_src/random.js', '../theatre/qt-rectangle.js', '../theatre/qt-quadtree.js')
markdown {'html': '', 'content': 'title: Linear Arrangement\ncategories: arrange\nfiles:\n head\n stage\n point\n pointlist\n dragging\n stroke\n mouse\n ../point_src/random.js\n ../theatre/qt-rectangle.js\n ../theatre/qt-quadtree.js'}