Skip to content

Instantly share code, notes, and snippets.

import Plugin from 'awv3/plugin/base';
import Integration from 'awv3/plugin/integration';
class MyPlugin extends Plugin {
constructor() {
super();
// ... functionality
}
}
@drcmda
drcmda / gist:9d308cb293781f322c77ad03e47e741f
Created September 16, 2016 08:30
multiple interaction handles, keyed
application
canvas
scene
class VersatileObject(obj1) -> eventhandler
obj2 -> eventhandler
obj3 -> eventhandler
plugins
UI elements [selection] -> notify
pluginsystem->events->override
@drcmda
drcmda / .js
Last active October 24, 2016 15:07
plugin specs, draft nearing final: PLUGIN DEFINITION
import Plugin from 'awv3/session/plugin';
import { Group, Button, Input, Label, Selection, Checkbox, Dropdown } from 'awv3/session/elements';
export default class extends Plugin {
constructor(session, { name }) {
super(session, { type: "Measure", name });
// 1. Elements SHOULD be created in the constructor. They can be stored in any way or form,
// in this case we use 'this' so that they are accessibable throuout the plugin
@drcmda
drcmda / .js
Created October 24, 2016 15:10
plugin specs, draft nearing final: SESSION USE
import Session from 'awv3/session';
// Create session
const session = window.session = new Session({
debug: true,
connection: 'http://localhost:8181/'
});
// Wait until we're connected
session.onConnected().then(server => {
@drcmda
drcmda / *.js
Last active November 15, 2017 09:41
Redux thunk example
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import _ from 'lodash';
// these types describe what i can do
const types = {
fetch: "ACTION_ADD",
remove: "ACTION_REMOVE"
}
@drcmda
drcmda / .js
Last active January 26, 2017 11:33
material, outlining extensible structures for appearance
// ALL material info (including opacity & color) is defined under a generialized "material"
// ALL properties are optional
// color & opacity will be removed from the protocol
material: {
type: BASIC | PHONG | LAMBERT | PHYSICAL | DASHED (lines only)
opacity: 0-1,
color: [0-255, 0-255, 0-255],
fog: true | false, // affected by fog
lights: true | false, // affected by lights
@drcmda
drcmda / .js
Created March 24, 2017 12:27
vue connect
import cloneDeep from 'lodash/cloneDeep';
import Session from 'awv3/session';
// Create & export session
export const session = window.session = new Session({ material: 'multi' });
// Export store
export const store = session.store;
// Mixin factory. Maps Redux props to Vue components
export const connect = (selector, props) => {
globals.color {
objectHoverColor: ...
materialHoverColor: ...
}
Mesh.material = [{ ... }, {}, {}] || { ... }
const array = [...Mesh.material]
array.forEach( ... )
import Reconciler from 'react-reconciler'
import omit from 'lodash/omit'
import capitalize from 'lodash/capitalize'
import { actions as elementActions } from './store/elements'
import * as Elements from './elements'
const roots = new Map()
const emptyObject = {}
const Renderer = Reconciler({
@drcmda
drcmda / package.json
Last active September 12, 2022 06:23
webpack 4
"scripts": {
"dev": "node .dev/webpack.dev.server.js",
"dev-prod": "node .dev/webpack.dev.server.js --production",
"build": "rimraf ./dist && webpack --config .dev/webpack.config.production.js --colors",
},
"devDependencies": {
"@babel/core": "7.0.0-beta.38",
"@babel/plugin-proposal-class-properties": "7.0.0-beta.38",
"@babel/plugin-proposal-decorators": "7.0.0-beta.38",
"@babel/plugin-transform-classes": "7.0.0-beta.38",