grid-panning-2.js

total 0
used 0
limit 0
/* title: Grid Panning category: grid plane files: head point pointlist ../point_src/extras.js ../point_src/math.js ../point_src/gridplane.js stage mouse dragging stroke */ // var gravity = {x: 0, y:-0.05}; // Gravity constant for helium balloon. var gravity = {x: 0, y:1}; // Gravity constant class MainStage extends Stage { canvas = 'playspace' mounted() { console.log('mounted') // this.mouse.position.vy = this.mouse.position.vx = 0 // new Point({ x: 200, y: 200, radius: 140, vx: 0, vy: 0}) this.point = this.center.copy().update({radius: 50}) //new Point({ x: 300, y: 100, vx: 0, vy: 0}) this.pin = this.center.copy().update({radius: 10}) this.dragging.add(this.pin, this.point) this.plane = new GridPlane(this.dimensions) this.plane.mounted(this.pin, this.point) } onContextmenu(e) { e.preventDefault() e.stopImmediatePropagation() return false; } onMousedown(ev) { // console.log('down') if(ev.button == 2) { this.plane.trackDown(Point.from(ev)) } } onMouseup(ev) { // console.log('Up') if(ev.button == 2) { this.plane.trackUp(Point.from(ev)) } } draw(ctx) { this.clear(ctx); let mp = this.mouse.point; let b = this.plane.panPlane(mp) this.panOffset = b this.plane.drawLines(ctx, ~~this.point.radius, b) let other = this.point let pin = this.pin other.pen.circle(ctx, {color:'red'}) pin.pen.indicator(ctx) } } const stage = MainStage.go()
Run
Meta Data
title Grid Panning
imports ()
files ('head', 'point', 'pointlist', '../point_src/extras.js', '../point_src/math.js', '../point_src/gridplane.js', 'stage', 'mouse', 'dragging', 'stroke')
unused_keys ()
unknown_keys ('category',)
category ['grid plane']
filepath_exists True
path grid-panning-2.js
filepath grid-panning-2.js
clean_files ('../point_src/core/head.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/extras.js', '../point_src/math.js', '../point_src/gridplane.js', '../point_src/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/events.js', '../point_src/automouse.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')
markdown {'html': '', 'content': 'title: Grid Panning\ncategory: grid plane\nfiles:\n head\n point\n pointlist\n ../point_src/extras.js\n ../point_src/math.js\n ../point_src/gridplane.js\n stage\n mouse\n dragging\n stroke'}