click-create-example.js

total 0
used 0
limit 0
/* files: ../point_src/core/head.js ../point_src/pointpen.js ../point_src/pointdraw.js ../point_src/math.js ../point_src/point-content.js ../point_src/pointlist.js ../point_src/pointlistpen.js ../point_src/point.js ../point_src/stage.js ../point_src/events.js ../point_src/automouse.js ../point_src/distances.js ../point_src/dragging.js ../point_src/setunset.js ../point_src/stroke.js ../point_src/functions/clamp.js // ../others/curve_src/curve.js ../point_src/extras.js ../point_src/text/alpha.js ../point_src/text/fps.js ../point_src/curve-extras.js --- */ var superV = 0 class RelativeNumber { constructor(parent, offset) { this.offset = offset } compute() { this.value = this.offset } } class MainStage extends Stage { canvas = 'playspace' mounted(){ this.point = (new Point(100, this.center.y)).quantize(100) this.clickPoint = this.center.copy(); this.points = new PointList(this.point, this.clickPoint) this.line = new Line(this.point, this.clickPoint, 'green', 2) let drag = this.drag = new Dragging drag.initDragging(this) drag.addPoints(this.point, this.clickPoint) drag.onClick = this.dragOnClick.bind(this) autoMouse.on(this.canvas, 'mouseup', this.mouseOnClick.bind(this)) } draw(ctx) { this.clear(ctx) // this.point.pen.indicator(ctx, {color:'#333'}) this.points.pen.indicators(ctx, {color: '#999'}) /* Follow the mouse */ this.drawMouse(ctx) this.line.render(ctx) /* The pinned point 100,100 */ let p = this.drag.getPoint(); if(p) { p.pen.circle(ctx) } } drawMouse(ctx) { let mouse = Point.mouse let pos = mouse.position // let color = mouse.isDown(0) ? 'red': '#444' this.point.radius = pos.radius = mouse.wheelSize()//(v)=>v*v) + 10 // pos.pen.indicator(ctx, { color }) // this.line.b = pos } rel(percent) { return new RelativeNumber(this, percent) } mouseOnClick(canvas, event) { // console.log('Custom click event', event) if(!this.drag.isDragging) { // let np = new Point({x:event.x,y:event.y, radius: this.mouse.wheelSize(true)}) // this.points.push(np) // this.drag.add(np) } } dragOnClick(event) { // console.log('Custom click event', event) // if(!this.drag.isDragging) { let np = new Point({x:event.x,y:event.y, radius: this.mouse.wheelSize(true)}) this.points.push(np) this.drag.add(np) // } } } stage = MainStage.go(/*{ loop: true }*/)
Run
Meta Data
imports ()
files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/math.js', '../point_src/point-content.js', '../point_src/pointlist.js', '../point_src/pointlistpen.js', '../point_src/point.js', '../point_src/stage.js', '../point_src/events.js', '../point_src/automouse.js', '../point_src/distances.js', '../point_src/dragging.js', '../point_src/setunset.js', '../point_src/stroke.js', '../point_src/functions/clamp.js', '// ../others/curve_src/curve.js', '../point_src/extras.js', '../point_src/text/alpha.js', '../point_src/text/fps.js', '../point_src/curve-extras.js')
unused_keys ('title',)
unknown_keys ()
filepath_exists True
path click-create-example.js
filepath click-create-example.js
clean_files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/math.js', '../point_src/compass.js', '../point_src/center.js', '../point_src/point-content.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/relative-xy.js', '../point_src/pointcast.js', '../point_src/point.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/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/functions/clamp.js', '../point_src/extras.js', '../point_src/text/alpha.js', '../point_src/smooth-number.js', '../point_src/text/fps.js', '../point_src/curve-extras.js')
markdown {'html': '', 'content': 'files:\n ../point_src/core/head.js\n ../point_src/pointpen.js\n ../point_src/pointdraw.js\n ../point_src/math.js\n ../point_src/point-content.js\n ../point_src/pointlist.js\n ../point_src/pointlistpen.js\n ../point_src/point.js\n ../point_src/stage.js\n ../point_src/events.js\n ../point_src/automouse.js\n ../point_src/distances.js\n ../point_src/dragging.js\n ../point_src/setunset.js\n ../point_src/stroke.js\n ../point_src/functions/clamp.js\n // ../others/curve_src/curve.js\n ../point_src/extras.js\n ../point_src/text/alpha.js\n ../point_src/text/fps.js\n ../point_src/curve-extras.js\n---'}