id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
7,800
clientIO/joint
dist/joint.nowrap.js
function(cells, opt) { return joint.util.toArray(cells).reduce(function(memo, cell) { if (cell.isLink()) return memo; var rect = cell.getBBox(opt); var angle = cell.angle(); if (angle) rect = rect.bbox(angle); if (memo) { return memo.u...
javascript
function(cells, opt) { return joint.util.toArray(cells).reduce(function(memo, cell) { if (cell.isLink()) return memo; var rect = cell.getBBox(opt); var angle = cell.angle(); if (angle) rect = rect.bbox(angle); if (memo) { return memo.u...
[ "function", "(", "cells", ",", "opt", ")", "{", "return", "joint", ".", "util", ".", "toArray", "(", "cells", ")", ".", "reduce", "(", "function", "(", "memo", ",", "cell", ")", "{", "if", "(", "cell", ".", "isLink", "(", ")", ")", "return", "mem...
Return the bounding box of all cells in array provided. Links are being ignored.
[ "Return", "the", "bounding", "box", "of", "all", "cells", "in", "array", "provided", ".", "Links", "are", "being", "ignored", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L10847-L10860
7,801
clientIO/joint
dist/joint.nowrap.js
dWrapper
function dWrapper(opt) { function pathConstructor(value) { return new g.Path(V.normalizePathData(value)); } var shape = shapeWrapper(pathConstructor, opt); return function(value, refBBox, node) { var path = shape(value, refBBox, node); return { ...
javascript
function dWrapper(opt) { function pathConstructor(value) { return new g.Path(V.normalizePathData(value)); } var shape = shapeWrapper(pathConstructor, opt); return function(value, refBBox, node) { var path = shape(value, refBBox, node); return { ...
[ "function", "dWrapper", "(", "opt", ")", "{", "function", "pathConstructor", "(", "value", ")", "{", "return", "new", "g", ".", "Path", "(", "V", ".", "normalizePathData", "(", "value", ")", ")", ";", "}", "var", "shape", "=", "shapeWrapper", "(", "pat...
`d` attribute for SVGPaths
[ "d", "attribute", "for", "SVGPaths" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L11078-L11089
7,802
clientIO/joint
dist/joint.nowrap.js
pointsWrapper
function pointsWrapper(opt) { var shape = shapeWrapper(g.Polyline, opt); return function(value, refBBox, node) { var polyline = shape(value, refBBox, node); return { points: polyline.serialize() }; }; }
javascript
function pointsWrapper(opt) { var shape = shapeWrapper(g.Polyline, opt); return function(value, refBBox, node) { var polyline = shape(value, refBBox, node); return { points: polyline.serialize() }; }; }
[ "function", "pointsWrapper", "(", "opt", ")", "{", "var", "shape", "=", "shapeWrapper", "(", "g", ".", "Polyline", ",", "opt", ")", ";", "return", "function", "(", "value", ",", "refBBox", ",", "node", ")", "{", "var", "polyline", "=", "shape", "(", ...
`points` attribute for SVGPolylines and SVGPolygons
[ "points", "attribute", "for", "SVGPolylines", "and", "SVGPolygons" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L11092-L11100
7,803
clientIO/joint
dist/joint.nowrap.js
function() { var ancestors = []; if (!this.graph) { return ancestors; } var parentCell = this.getParentCell(); while (parentCell) { ancestors.push(parentCell); parentCell = parentCell.getParentCell(); } return ancestors; ...
javascript
function() { var ancestors = []; if (!this.graph) { return ancestors; } var parentCell = this.getParentCell(); while (parentCell) { ancestors.push(parentCell); parentCell = parentCell.getParentCell(); } return ancestors; ...
[ "function", "(", ")", "{", "var", "ancestors", "=", "[", "]", ";", "if", "(", "!", "this", ".", "graph", ")", "{", "return", "ancestors", ";", "}", "var", "parentCell", "=", "this", ".", "getParentCell", "(", ")", ";", "while", "(", "parentCell", "...
Return an array of ancestor cells. The array is ordered from the parent of the cell to the most distant ancestor.
[ "Return", "an", "array", "of", "ancestor", "cells", ".", "The", "array", "is", "ordered", "from", "the", "parent", "of", "the", "cell", "to", "the", "most", "distant", "ancestor", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L12071-L12086
7,804
clientIO/joint
dist/joint.nowrap.js
function(path, opt) { // Once a property is removed from the `attrs` attribute // the cellView will recognize a `dirty` flag and rerender itself // in order to remove the attribute from SVG element. opt = opt || {}; opt.dirty = true; var pathArray = Array.isArray(path) ...
javascript
function(path, opt) { // Once a property is removed from the `attrs` attribute // the cellView will recognize a `dirty` flag and rerender itself // in order to remove the attribute from SVG element. opt = opt || {}; opt.dirty = true; var pathArray = Array.isArray(path) ...
[ "function", "(", "path", ",", "opt", ")", "{", "// Once a property is removed from the `attrs` attribute", "// the cellView will recognize a `dirty` flag and rerender itself", "// in order to remove the attribute from SVG element.", "opt", "=", "opt", "||", "{", "}", ";", "opt", ...
A convient way to unset nested properties
[ "A", "convient", "way", "to", "unset", "nested", "properties" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L12280-L12303
7,805
clientIO/joint
dist/joint.nowrap.js
function(attrs, value, opt) { var args = Array.from(arguments); if (args.length === 0) { return this.get('attrs'); } if (Array.isArray(attrs)) { args[0] = ['attrs'].concat(attrs); } else if (joint.util.isString(attrs)) { // Get/set an attribu...
javascript
function(attrs, value, opt) { var args = Array.from(arguments); if (args.length === 0) { return this.get('attrs'); } if (Array.isArray(attrs)) { args[0] = ['attrs'].concat(attrs); } else if (joint.util.isString(attrs)) { // Get/set an attribu...
[ "function", "(", "attrs", ",", "value", ",", "opt", ")", "{", "var", "args", "=", "Array", ".", "from", "(", "arguments", ")", ";", "if", "(", "args", ".", "length", "===", "0", ")", "{", "return", "this", ".", "get", "(", "'attrs'", ")", ";", ...
A convenient way to set nested attributes.
[ "A", "convenient", "way", "to", "set", "nested", "attributes", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L12306-L12326
7,806
clientIO/joint
dist/joint.nowrap.js
function(path, opt) { if (Array.isArray(path)) { return this.removeProp(['attrs'].concat(path)); } return this.removeProp('attrs/' + path, opt); }
javascript
function(path, opt) { if (Array.isArray(path)) { return this.removeProp(['attrs'].concat(path)); } return this.removeProp('attrs/' + path, opt); }
[ "function", "(", "path", ",", "opt", ")", "{", "if", "(", "Array", ".", "isArray", "(", "path", ")", ")", "{", "return", "this", ".", "removeProp", "(", "[", "'attrs'", "]", ".", "concat", "(", "path", ")", ")", ";", "}", "return", "this", ".", ...
A convenient way to unset nested attributes
[ "A", "convenient", "way", "to", "unset", "nested", "attributes" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L12329-L12337
7,807
clientIO/joint
dist/joint.nowrap.js
function(el) { var $el = this.$(el); var $rootEl = this.$el; if ($el.length === 0) { $el = $rootEl; } do { var magnet = $el.attr('magnet'); if ((magnet || $el.is($rootEl)) && magnet !== 'false') { return $el[0]; ...
javascript
function(el) { var $el = this.$(el); var $rootEl = this.$el; if ($el.length === 0) { $el = $rootEl; } do { var magnet = $el.attr('magnet'); if ((magnet || $el.is($rootEl)) && magnet !== 'false') { return $el[0]; ...
[ "function", "(", "el", ")", "{", "var", "$el", "=", "this", ".", "$", "(", "el", ")", ";", "var", "$rootEl", "=", "this", ".", "$el", ";", "if", "(", "$el", ".", "length", "===", "0", ")", "{", "$el", "=", "$rootEl", ";", "}", "do", "{", "v...
Find the closest element that has the `magnet` attribute set to `true`. If there was not such an element found, return the root element of the cell view.
[ "Find", "the", "closest", "element", "that", "has", "the", "magnet", "attribute", "set", "to", "true", ".", "If", "there", "was", "not", "such", "an", "element", "found", "return", "the", "root", "element", "of", "the", "cell", "view", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L12672-L12697
7,808
clientIO/joint
dist/joint.nowrap.js
function(el, prevSelector) { var selector; if (el === this.el) { if (typeof prevSelector === 'string') selector = '> ' + prevSelector; return selector; } if (el) { var nthChild = V(el).index() + 1; selector = el.tagName + ':nth-child(' ...
javascript
function(el, prevSelector) { var selector; if (el === this.el) { if (typeof prevSelector === 'string') selector = '> ' + prevSelector; return selector; } if (el) { var nthChild = V(el).index() + 1; selector = el.tagName + ':nth-child(' ...
[ "function", "(", "el", ",", "prevSelector", ")", "{", "var", "selector", ";", "if", "(", "el", "===", "this", ".", "el", ")", "{", "if", "(", "typeof", "prevSelector", "===", "'string'", ")", "selector", "=", "'> '", "+", "prevSelector", ";", "return",...
Construct a unique selector for the `el` element within this view. `prevSelector` is being collected through the recursive call. No value for `prevSelector` is expected when using this method.
[ "Construct", "a", "unique", "selector", "for", "the", "el", "element", "within", "this", "view", ".", "prevSelector", "is", "being", "collected", "through", "the", "recursive", "call", ".", "No", "value", "for", "prevSelector", "is", "expected", "when", "using...
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L12702-L12724
7,809
clientIO/joint
dist/joint.nowrap.js
function(angle, absolute, origin, opt) { if (origin) { var center = this.getBBox().center(); var size = this.get('size'); var position = this.get('position'); center.rotate(origin, this.get('angle') - angle); var dx = center.x - size.width / 2 - posi...
javascript
function(angle, absolute, origin, opt) { if (origin) { var center = this.getBBox().center(); var size = this.get('size'); var position = this.get('position'); center.rotate(origin, this.get('angle') - angle); var dx = center.x - size.width / 2 - posi...
[ "function", "(", "angle", ",", "absolute", ",", "origin", ",", "opt", ")", "{", "if", "(", "origin", ")", "{", "var", "center", "=", "this", ".", "getBBox", "(", ")", ".", "center", "(", ")", ";", "var", "size", "=", "this", ".", "get", "(", "'...
Rotate element by `angle` degrees, optionally around `origin` point. If `origin` is not provided, it is considered to be the center of the element. If `absolute` is `true`, the `angle` is considered is abslute, i.e. it is not the difference from the previous angle.
[ "Rotate", "element", "by", "angle", "degrees", "optionally", "around", "origin", "point", ".", "If", "origin", "is", "not", "provided", "it", "is", "considered", "to", "be", "the", "center", "of", "the", "element", ".", "If", "absolute", "is", "true", "the...
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L13678-L13699
7,810
clientIO/joint
dist/joint.nowrap.js
function() { var element = this.model; var markup = element.get('markup') || element.markup; if (!markup) throw new Error('dia.ElementView: markup required'); if (Array.isArray(markup)) return this.renderJSONMarkup(markup); if (typeof markup === 'string') return this.renderStrin...
javascript
function() { var element = this.model; var markup = element.get('markup') || element.markup; if (!markup) throw new Error('dia.ElementView: markup required'); if (Array.isArray(markup)) return this.renderJSONMarkup(markup); if (typeof markup === 'string') return this.renderStrin...
[ "function", "(", ")", "{", "var", "element", "=", "this", ".", "model", ";", "var", "markup", "=", "element", ".", "get", "(", "'markup'", ")", "||", "element", ".", "markup", ";", "if", "(", "!", "markup", ")", "throw", "new", "Error", "(", "'dia....
`prototype.markup` is rendered by default. Set the `markup` attribute on the model if the default markup is not desirable.
[ "prototype", ".", "markup", "is", "rendered", "by", "default", ".", "Set", "the", "markup", "attribute", "on", "the", "model", "if", "the", "default", "markup", "is", "not", "desirable", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L13808-L13816
7,811
clientIO/joint
dist/joint.nowrap.js
function(evt, x, y) { var data = this.eventData(evt); if (data.embedding) this.finalizeEmbedding(data); }
javascript
function(evt, x, y) { var data = this.eventData(evt); if (data.embedding) this.finalizeEmbedding(data); }
[ "function", "(", "evt", ",", "x", ",", "y", ")", "{", "var", "data", "=", "this", ".", "eventData", "(", "evt", ")", ";", "if", "(", "data", ".", "embedding", ")", "this", ".", "finalizeEmbedding", "(", "data", ")", ";", "}" ]
Drag End Handlers
[ "Drag", "End", "Handlers" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L14465-L14469
7,812
clientIO/joint
dist/joint.nowrap.js
function(idx, label, opt) { var labels = this.labels(); idx = (isFinite(idx) && idx !== null) ? (idx | 0) : 0; if (idx < 0) idx = labels.length + idx; // getter if (arguments.length <= 1) return this.prop(['labels', idx]); // setter return this.prop(['labels', ...
javascript
function(idx, label, opt) { var labels = this.labels(); idx = (isFinite(idx) && idx !== null) ? (idx | 0) : 0; if (idx < 0) idx = labels.length + idx; // getter if (arguments.length <= 1) return this.prop(['labels', idx]); // setter return this.prop(['labels', ...
[ "function", "(", "idx", ",", "label", ",", "opt", ")", "{", "var", "labels", "=", "this", ".", "labels", "(", ")", ";", "idx", "=", "(", "isFinite", "(", "idx", ")", "&&", "idx", "!==", "null", ")", "?", "(", "idx", "|", "0", ")", ":", "0", ...
Labels API A convenient way to set labels. Currently set values will be mixined with `value` if used as a setter.
[ "Labels", "API", "A", "convenient", "way", "to", "set", "labels", ".", "Currently", "set", "values", "will", "be", "mixined", "with", "value", "if", "used", "as", "a", "setter", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L14738-L14749
7,813
clientIO/joint
dist/joint.nowrap.js
function() { var connectionAncestor; if (this.graph) { var cells = [ this, this.getSourceElement(), // null if source is a point this.getTargetElement() // null if target is a point ].filter(function(item) { retur...
javascript
function() { var connectionAncestor; if (this.graph) { var cells = [ this, this.getSourceElement(), // null if source is a point this.getTargetElement() // null if target is a point ].filter(function(item) { retur...
[ "function", "(", ")", "{", "var", "connectionAncestor", ";", "if", "(", "this", ".", "graph", ")", "{", "var", "cells", "=", "[", "this", ",", "this", ".", "getSourceElement", "(", ")", ",", "// null if source is a point", "this", ".", "getTargetElement", ...
Returns the common ancestor for the source element, target element and the link itself.
[ "Returns", "the", "common", "ancestor", "for", "the", "source", "element", "target", "element", "and", "the", "link", "itself", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L14973-L14991
7,814
clientIO/joint
dist/joint.nowrap.js
function(cell) { var cellId = (joint.util.isString(cell) || joint.util.isNumber(cell)) ? cell : cell.id; var ancestor = this.getRelationshipAncestor(); return !!ancestor && (ancestor.id === cellId || ancestor.isEmbeddedIn(cellId)); }
javascript
function(cell) { var cellId = (joint.util.isString(cell) || joint.util.isNumber(cell)) ? cell : cell.id; var ancestor = this.getRelationshipAncestor(); return !!ancestor && (ancestor.id === cellId || ancestor.isEmbeddedIn(cellId)); }
[ "function", "(", "cell", ")", "{", "var", "cellId", "=", "(", "joint", ".", "util", ".", "isString", "(", "cell", ")", "||", "joint", ".", "util", ".", "isNumber", "(", "cell", ")", ")", "?", "cell", ":", "cell", ".", "id", ";", "var", "ancestor"...
Is source, target and the link itself embedded in a given cell?
[ "Is", "source", "target", "and", "the", "link", "itself", "embedded", "in", "a", "given", "cell?" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L14994-L15000
7,815
clientIO/joint
dist/joint.nowrap.js
function() { var defaultLabel = this.get('defaultLabel') || this.defaultLabel || {}; var label = {}; label.markup = defaultLabel.markup || this.get('labelMarkup') || this.labelMarkup; label.position = defaultLabel.position; label.attrs = defaultLabel.attrs; label.size =...
javascript
function() { var defaultLabel = this.get('defaultLabel') || this.defaultLabel || {}; var label = {}; label.markup = defaultLabel.markup || this.get('labelMarkup') || this.labelMarkup; label.position = defaultLabel.position; label.attrs = defaultLabel.attrs; label.size =...
[ "function", "(", ")", "{", "var", "defaultLabel", "=", "this", ".", "get", "(", "'defaultLabel'", ")", "||", "this", ".", "defaultLabel", "||", "{", "}", ";", "var", "label", "=", "{", "}", ";", "label", ".", "markup", "=", "defaultLabel", ".", "mark...
Get resolved default label.
[ "Get", "resolved", "default", "label", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L15003-L15014
7,816
clientIO/joint
dist/joint.nowrap.js
function(endType) { // create handler for specific end type (source|target). var onModelChange = function(endModel, opt) { this.onEndModelChange(endType, endModel, opt); }; function watchEndModel(link, end) { end = end || {}; var endModel = null; ...
javascript
function(endType) { // create handler for specific end type (source|target). var onModelChange = function(endModel, opt) { this.onEndModelChange(endType, endModel, opt); }; function watchEndModel(link, end) { end = end || {}; var endModel = null; ...
[ "function", "(", "endType", ")", "{", "// create handler for specific end type (source|target).", "var", "onModelChange", "=", "function", "(", "endModel", ",", "opt", ")", "{", "this", ".", "onEndModelChange", "(", "endType", ",", "endModel", ",", "opt", ")", ";"...
Returns a function observing changes on an end of the link. If a change happens and new end is a new model, it stops listening on the previous one and starts listening to the new one.
[ "Returns", "a", "function", "observing", "changes", "on", "an", "end", "of", "the", "link", ".", "If", "a", "change", "happens", "and", "new", "end", "is", "a", "new", "model", "it", "stops", "listening", "on", "the", "previous", "one", "and", "starts", ...
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L15981-L16011
7,817
clientIO/joint
dist/joint.nowrap.js
function(x, y, opt) { // accept input in form `{ x, y }, opt` or `x, y, opt` var isPointProvided = (typeof x !== 'number'); var localX = isPointProvided ? x.x : x; var localY = isPointProvided ? x.y : y; var localOpt = isPointProvided ? y : opt; var vertex = { x: localX...
javascript
function(x, y, opt) { // accept input in form `{ x, y }, opt` or `x, y, opt` var isPointProvided = (typeof x !== 'number'); var localX = isPointProvided ? x.x : x; var localY = isPointProvided ? x.y : y; var localOpt = isPointProvided ? y : opt; var vertex = { x: localX...
[ "function", "(", "x", ",", "y", ",", "opt", ")", "{", "// accept input in form `{ x, y }, opt` or `x, y, opt`", "var", "isPointProvided", "=", "(", "typeof", "x", "!==", "'number'", ")", ";", "var", "localX", "=", "isPointProvided", "?", "x", ".", "x", ":", ...
Add a new vertex at calculated index to the `vertices` array.
[ "Add", "a", "new", "vertex", "at", "calculated", "index", "to", "the", "vertices", "array", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L16194-L16206
7,818
clientIO/joint
dist/joint.nowrap.js
function(angle, cx, cy) { // getter if (angle === undefined) { return V.matrixToRotate(this.matrix()); } // setter // If the origin is not set explicitely, rotate around the center. Note that // we must use the plain bounding box (`this.el.getBBox()` instea...
javascript
function(angle, cx, cy) { // getter if (angle === undefined) { return V.matrixToRotate(this.matrix()); } // setter // If the origin is not set explicitely, rotate around the center. Note that // we must use the plain bounding box (`this.el.getBBox()` instea...
[ "function", "(", "angle", ",", "cx", ",", "cy", ")", "{", "// getter", "if", "(", "angle", "===", "undefined", ")", "{", "return", "V", ".", "matrixToRotate", "(", "this", ".", "matrix", "(", ")", ")", ";", "}", "// setter", "// If the origin is not set ...
Experimental - do not use in production.
[ "Experimental", "-", "do", "not", "use", "in", "production", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L18161-L18183
7,819
clientIO/joint
dist/joint.nowrap.js
function($el) { var el = joint.util.isString($el) ? this.viewport.querySelector($el) : $el instanceof $ ? $el[0] : $el; var id = this.findAttribute('model-id', el); if (id) return this._views[id]; return undefined; }
javascript
function($el) { var el = joint.util.isString($el) ? this.viewport.querySelector($el) : $el instanceof $ ? $el[0] : $el; var id = this.findAttribute('model-id', el); if (id) return this._views[id]; return undefined; }
[ "function", "(", "$el", ")", "{", "var", "el", "=", "joint", ".", "util", ".", "isString", "(", "$el", ")", "?", "this", ".", "viewport", ".", "querySelector", "(", "$el", ")", ":", "$el", "instanceof", "$", "?", "$el", "[", "0", "]", ":", "$el",...
Find the first view climbing up the DOM tree starting at element `el`. Note that `el` can also be a selector or a jQuery object.
[ "Find", "the", "first", "view", "climbing", "up", "the", "DOM", "tree", "starting", "at", "element", "el", ".", "Note", "that", "el", "can", "also", "be", "a", "selector", "or", "a", "jQuery", "object", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L18216-L18226
7,820
clientIO/joint
dist/joint.nowrap.js
function(cell) { var id = (joint.util.isString(cell) || joint.util.isNumber(cell)) ? cell : (cell && cell.id); return this._views[id]; }
javascript
function(cell) { var id = (joint.util.isString(cell) || joint.util.isNumber(cell)) ? cell : (cell && cell.id); return this._views[id]; }
[ "function", "(", "cell", ")", "{", "var", "id", "=", "(", "joint", ".", "util", ".", "isString", "(", "cell", ")", "||", "joint", ".", "util", ".", "isNumber", "(", "cell", ")", ")", "?", "cell", ":", "(", "cell", "&&", "cell", ".", "id", ")", ...
Find a view for a model `cell`. `cell` can also be a string or number representing a model `id`.
[ "Find", "a", "view", "for", "a", "model", "cell", ".", "cell", "can", "also", "be", "a", "string", "or", "number", "representing", "a", "model", "id", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L18229-L18234
7,821
clientIO/joint
dist/joint.nowrap.js
function(p) { p = new g.Point(p); var views = this.model.getElements().map(this.findViewByModel, this); return views.filter(function(view) { return view && view.vel.getBBox({ target: this.viewport }).containsPoint(p); }, this); }
javascript
function(p) { p = new g.Point(p); var views = this.model.getElements().map(this.findViewByModel, this); return views.filter(function(view) { return view && view.vel.getBBox({ target: this.viewport }).containsPoint(p); }, this); }
[ "function", "(", "p", ")", "{", "p", "=", "new", "g", ".", "Point", "(", "p", ")", ";", "var", "views", "=", "this", ".", "model", ".", "getElements", "(", ")", ".", "map", "(", "this", ".", "findViewByModel", ",", "this", ")", ";", "return", "...
Find all views at given point
[ "Find", "all", "views", "at", "given", "point" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L18237-L18246
7,822
clientIO/joint
dist/joint.nowrap.js
function(rect, opt) { opt = joint.util.defaults(opt || {}, { strict: false }); rect = new g.Rect(rect); var views = this.model.getElements().map(this.findViewByModel, this); var method = opt.strict ? 'containsRect' : 'intersect'; return views.filter(function(view) { ...
javascript
function(rect, opt) { opt = joint.util.defaults(opt || {}, { strict: false }); rect = new g.Rect(rect); var views = this.model.getElements().map(this.findViewByModel, this); var method = opt.strict ? 'containsRect' : 'intersect'; return views.filter(function(view) { ...
[ "function", "(", "rect", ",", "opt", ")", "{", "opt", "=", "joint", ".", "util", ".", "defaults", "(", "opt", "||", "{", "}", ",", "{", "strict", ":", "false", "}", ")", ";", "rect", "=", "new", "g", ".", "Rect", "(", "rect", ")", ";", "var",...
Find all views in given area
[ "Find", "all", "views", "in", "given", "area" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L18249-L18260
7,823
clientIO/joint
dist/joint.nowrap.js
function(evt, view) { if (evt.type === 'mousedown' && evt.button === 2) { // handled as `contextmenu` type return true; } if (this.options.guard && this.options.guard(evt, view)) { return true; } if (evt.data && evt.data.guarded !== undefine...
javascript
function(evt, view) { if (evt.type === 'mousedown' && evt.button === 2) { // handled as `contextmenu` type return true; } if (this.options.guard && this.options.guard(evt, view)) { return true; } if (evt.data && evt.data.guarded !== undefine...
[ "function", "(", "evt", ",", "view", ")", "{", "if", "(", "evt", ".", "type", "===", "'mousedown'", "&&", "evt", ".", "button", "===", "2", ")", "{", "// handled as `contextmenu` type", "return", "true", ";", "}", "if", "(", "this", ".", "options", "."...
Guard the specified event. If the event is not interesting, guard returns `true`. Otherwise, it returns `false`.
[ "Guard", "the", "specified", "event", ".", "If", "the", "event", "is", "not", "interesting", "guard", "returns", "true", ".", "Otherwise", "it", "returns", "false", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L18828-L18852
7,824
clientIO/joint
dist/joint.nowrap.js
function() { var current = this.get('ports') || {}; var currentItemsMap = {}; util.toArray(current.items).forEach(function(item) { currentItemsMap[item.id] = true; }); var previous = this.previous('ports') || {}; var removed = {}...
javascript
function() { var current = this.get('ports') || {}; var currentItemsMap = {}; util.toArray(current.items).forEach(function(item) { currentItemsMap[item.id] = true; }); var previous = this.previous('ports') || {}; var removed = {}...
[ "function", "(", ")", "{", "var", "current", "=", "this", ".", "get", "(", "'ports'", ")", "||", "{", "}", ";", "var", "currentItemsMap", "=", "{", "}", ";", "util", ".", "toArray", "(", "current", ".", "items", ")", ".", "forEach", "(", "function"...
remove links tied wiht just removed element @private
[ "remove", "links", "tied", "wiht", "just", "removed", "element" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L19640-L19673
7,825
clientIO/joint
dist/joint.nowrap.js
function(port) { if (this._portElementsCache[port.id]) { return this._portElementsCache[port.id].portElement; } return this._createPortElement(port); }
javascript
function(port) { if (this._portElementsCache[port.id]) { return this._portElementsCache[port.id].portElement; } return this._createPortElement(port); }
[ "function", "(", "port", ")", "{", "if", "(", "this", ".", "_portElementsCache", "[", "port", ".", "id", "]", ")", "{", "return", "this", ".", "_portElementsCache", "[", "port", ".", "id", "]", ".", "portElement", ";", "}", "return", "this", ".", "_c...
Try to get element from cache, @param port @returns {*} @private
[ "Try", "to", "get", "element", "from", "cache" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L20063-L20069
7,826
clientIO/joint
dist/joint.nowrap.js
freeJoin
function freeJoin(p1, p2, bbox) { var p = new g.Point(p1.x, p2.y); if (bbox.containsPoint(p)) p = new g.Point(p2.x, p1.y); // kept for reference // if (bbox.containsPoint(p)) p = null; return p; }
javascript
function freeJoin(p1, p2, bbox) { var p = new g.Point(p1.x, p2.y); if (bbox.containsPoint(p)) p = new g.Point(p2.x, p1.y); // kept for reference // if (bbox.containsPoint(p)) p = null; return p; }
[ "function", "freeJoin", "(", "p1", ",", "p2", ",", "bbox", ")", "{", "var", "p", "=", "new", "g", ".", "Point", "(", "p1", ".", "x", ",", "p2", ".", "y", ")", ";", "if", "(", "bbox", ".", "containsPoint", "(", "p", ")", ")", "p", "=", "new"...
returns a point `p` where lines p,p1 and p,p2 are perpendicular and p is not contained in the given box
[ "returns", "a", "point", "p", "where", "lines", "p", "p1", "and", "p", "p2", "are", "perpendicular", "and", "p", "is", "not", "contained", "in", "the", "given", "box" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L22476-L22484
7,827
clientIO/joint
dist/joint.nowrap.js
insideElement
function insideElement(from, to, fromBBox, toBBox, bearing) { var route = {}; var boundary = fromBBox.union(toBBox).inflate(1); // start from the point which is closer to the boundary var reversed = boundary.center().distance(to) > boundary.center().distance(from); var start = ...
javascript
function insideElement(from, to, fromBBox, toBBox, bearing) { var route = {}; var boundary = fromBBox.union(toBBox).inflate(1); // start from the point which is closer to the boundary var reversed = boundary.center().distance(to) > boundary.center().distance(from); var start = ...
[ "function", "insideElement", "(", "from", ",", "to", ",", "fromBBox", ",", "toBBox", ",", "bearing", ")", "{", "var", "route", "=", "{", "}", ";", "var", "boundary", "=", "fromBBox", ".", "union", "(", "toBBox", ")", ".", "inflate", "(", "1", ")", ...
Finds route for situations where one element is inside the other. Typically the route is directed outside the outer element first and then back towards the inner element.
[ "Finds", "route", "for", "situations", "where", "one", "element", "is", "inside", "the", "other", ".", "Typically", "the", "route", "is", "directed", "outside", "the", "outer", "element", "first", "and", "then", "back", "towards", "the", "inner", "element", ...
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L22640-L22677
7,828
clientIO/joint
dist/joint.nowrap.js
router
function router(vertices, opt, linkView) { var sourceBBox = getSourceBBox(linkView, opt); var targetBBox = getTargetBBox(linkView, opt); var sourceAnchor = getSourceAnchor(linkView, opt); var targetAnchor = getTargetAnchor(linkView, opt); // if anchor lies outside of bbox, the...
javascript
function router(vertices, opt, linkView) { var sourceBBox = getSourceBBox(linkView, opt); var targetBBox = getTargetBBox(linkView, opt); var sourceAnchor = getSourceAnchor(linkView, opt); var targetAnchor = getTargetAnchor(linkView, opt); // if anchor lies outside of bbox, the...
[ "function", "router", "(", "vertices", ",", "opt", ",", "linkView", ")", "{", "var", "sourceBBox", "=", "getSourceBBox", "(", "linkView", ",", "opt", ")", ";", "var", "targetBBox", "=", "getTargetBBox", "(", "linkView", ",", "opt", ")", ";", "var", "sour...
Return points through which a connection needs to be drawn in order to obtain an orthogonal link routing from source to target going through `vertices`.
[ "Return", "points", "through", "which", "a", "connection", "needs", "to", "be", "drawn", "in", "order", "to", "obtain", "an", "orthogonal", "link", "routing", "from", "source", "to", "target", "going", "through", "vertices", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L22683-L22769
7,829
clientIO/joint
dist/joint.nowrap.js
modelCenter
function modelCenter(view, magnet) { var model = view.model; var bbox = model.getBBox(); var center = bbox.center(); var angle = model.angle(); var portId = view.findAttribute('port', magnet); if (portId) { var portGroup = model.portProp(portId, 'group'); ...
javascript
function modelCenter(view, magnet) { var model = view.model; var bbox = model.getBBox(); var center = bbox.center(); var angle = model.angle(); var portId = view.findAttribute('port', magnet); if (portId) { var portGroup = model.portProp(portId, 'group'); ...
[ "function", "modelCenter", "(", "view", ",", "magnet", ")", "{", "var", "model", "=", "view", ".", "model", ";", "var", "bbox", "=", "model", ".", "getBBox", "(", ")", ";", "var", "center", "=", "bbox", ".", "center", "(", ")", ";", "var", "angle",...
Can find anchor from model, when there is no selector or the link end is connected to a port
[ "Can", "find", "anchor", "from", "model", "when", "there", "is", "no", "selector", "or", "the", "link", "end", "is", "connected", "to", "a", "port" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L23945-L23962
7,830
clientIO/joint
tutorials/js/pipes.js
function(ctx, from, to, width, gradient) { var innerWidth = width - 4; var outerWidth = width; var buttFrom = g.point(from).move(to, -outerWidth / 2); var buttTo = g.point(to).move(from, -outerWidth / 2); ctx.beginPath(); ctx.lineWidth = outerWidth; ctx.strokeSt...
javascript
function(ctx, from, to, width, gradient) { var innerWidth = width - 4; var outerWidth = width; var buttFrom = g.point(from).move(to, -outerWidth / 2); var buttTo = g.point(to).move(from, -outerWidth / 2); ctx.beginPath(); ctx.lineWidth = outerWidth; ctx.strokeSt...
[ "function", "(", "ctx", ",", "from", ",", "to", ",", "width", ",", "gradient", ")", "{", "var", "innerWidth", "=", "width", "-", "4", ";", "var", "outerWidth", "=", "width", ";", "var", "buttFrom", "=", "g", ".", "point", "(", "from", ")", ".", "...
A drawing function executed for all links segments.
[ "A", "drawing", "function", "executed", "for", "all", "links", "segments", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/tutorials/js/pipes.js#L143-L189
7,831
clientIO/joint
demo/chess/src/garbochess.js
SeeAddKnightAttacks
function SeeAddKnightAttacks(target, us, attacks) { var pieceIdx = (us | pieceKnight) << 4; var attackerSq = g_pieceList[pieceIdx++]; while (attackerSq != 0) { if (IsSquareOnPieceLine(target, attackerSq)) { attacks[attacks.length] = attackerSq; } attackerSq = g_pieceList...
javascript
function SeeAddKnightAttacks(target, us, attacks) { var pieceIdx = (us | pieceKnight) << 4; var attackerSq = g_pieceList[pieceIdx++]; while (attackerSq != 0) { if (IsSquareOnPieceLine(target, attackerSq)) { attacks[attacks.length] = attackerSq; } attackerSq = g_pieceList...
[ "function", "SeeAddKnightAttacks", "(", "target", ",", "us", ",", "attacks", ")", "{", "var", "pieceIdx", "=", "(", "us", "|", "pieceKnight", ")", "<<", "4", ";", "var", "attackerSq", "=", "g_pieceList", "[", "pieceIdx", "++", "]", ";", "while", "(", "...
target = attacking square, us = color of knights to look for, attacks = array to add squares to
[ "target", "=", "attacking", "square", "us", "=", "color", "of", "knights", "to", "look", "for", "attacks", "=", "array", "to", "add", "squares", "to" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/demo/chess/src/garbochess.js#L2446-L2456
7,832
clientIO/joint
src/geometry.js
function(p, opt) { opt = opt || {}; var precision = (opt.precision === undefined) ? this.PRECISION : opt.precision; var subdivisions = (opt.subdivisions === undefined) ? this.getSubdivisions({ precision: precision }) : opt.subdivisions; // does not use localOpt // identify the ...
javascript
function(p, opt) { opt = opt || {}; var precision = (opt.precision === undefined) ? this.PRECISION : opt.precision; var subdivisions = (opt.subdivisions === undefined) ? this.getSubdivisions({ precision: precision }) : opt.subdivisions; // does not use localOpt // identify the ...
[ "function", "(", "p", ",", "opt", ")", "{", "opt", "=", "opt", "||", "{", "}", ";", "var", "precision", "=", "(", "opt", ".", "precision", "===", "undefined", ")", "?", "this", ".", "PRECISION", ":", "opt", ".", "precision", ";", "var", "subdivisio...
Returns `t` of the point on the curve closest to point `p`
[ "Returns", "t", "of", "the", "point", "on", "the", "curve", "closest", "to", "point", "p" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/src/geometry.js#L484-L583
7,833
clientIO/joint
src/geometry.js
function(p) { var start = this.start; var end = this.end; if (start.cross(p, end) !== 0) return false; // else: cross product of 0 indicates that this line and the vector to `p` are collinear var length = this.length(); if ((new g.Line(start, p)).length() > length) ret...
javascript
function(p) { var start = this.start; var end = this.end; if (start.cross(p, end) !== 0) return false; // else: cross product of 0 indicates that this line and the vector to `p` are collinear var length = this.length(); if ((new g.Line(start, p)).length() > length) ret...
[ "function", "(", "p", ")", "{", "var", "start", "=", "this", ".", "start", ";", "var", "end", "=", "this", ".", "end", ";", "if", "(", "start", ".", "cross", "(", "p", ",", "end", ")", "!==", "0", ")", "return", "false", ";", "// else: cross prod...
Returns `true` if the point lies on the line.
[ "Returns", "true", "if", "the", "point", "lies", "on", "the", "line", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/src/geometry.js#L1402-L1416
7,834
clientIO/joint
src/geometry.js
function(ratio) { var dividerPoint = this.pointAt(ratio); // return array with two new lines return [ new Line(this.start, dividerPoint), new Line(dividerPoint, this.end) ]; }
javascript
function(ratio) { var dividerPoint = this.pointAt(ratio); // return array with two new lines return [ new Line(this.start, dividerPoint), new Line(dividerPoint, this.end) ]; }
[ "function", "(", "ratio", ")", "{", "var", "dividerPoint", "=", "this", ".", "pointAt", "(", "ratio", ")", ";", "// return array with two new lines", "return", "[", "new", "Line", "(", "this", ".", "start", ",", "dividerPoint", ")", ",", "new", "Line", "("...
Divides the line into two at requested `ratio` between 0 and 1.
[ "Divides", "the", "line", "into", "two", "at", "requested", "ratio", "between", "0", "and", "1", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/src/geometry.js#L1419-L1428
7,835
clientIO/joint
src/geometry.js
function(length) { var dividerPoint = this.pointAtLength(length); // return array with two new lines return [ new Line(this.start, dividerPoint), new Line(dividerPoint, this.end) ]; }
javascript
function(length) { var dividerPoint = this.pointAtLength(length); // return array with two new lines return [ new Line(this.start, dividerPoint), new Line(dividerPoint, this.end) ]; }
[ "function", "(", "length", ")", "{", "var", "dividerPoint", "=", "this", ".", "pointAtLength", "(", "length", ")", ";", "// return array with two new lines", "return", "[", "new", "Line", "(", "this", ".", "start", ",", "dividerPoint", ")", ",", "new", "Line...
Divides the line into two at requested `length`.
[ "Divides", "the", "line", "into", "two", "at", "requested", "length", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/src/geometry.js#L1431-L1440
7,836
clientIO/joint
src/geometry.js
function(ratio, opt) { var segments = this.segments; var numSegments = segments.length; if (numSegments === 0) return null; // if segments is an empty array if (ratio < 0) ratio = 0; if (ratio > 1) ratio = 1; opt = opt || {}; var precision = (opt.precision === ...
javascript
function(ratio, opt) { var segments = this.segments; var numSegments = segments.length; if (numSegments === 0) return null; // if segments is an empty array if (ratio < 0) ratio = 0; if (ratio > 1) ratio = 1; opt = opt || {}; var precision = (opt.precision === ...
[ "function", "(", "ratio", ",", "opt", ")", "{", "var", "segments", "=", "this", ".", "segments", ";", "var", "numSegments", "=", "segments", ".", "length", ";", "if", "(", "numSegments", "===", "0", ")", "return", "null", ";", "// if segments is an empty a...
Divides the path into two at requested `ratio` between 0 and 1 with precision better than `opt.precision`; optionally using `opt.subdivisions` provided.
[ "Divides", "the", "path", "into", "two", "at", "requested", "ratio", "between", "0", "and", "1", "with", "precision", "better", "than", "opt", ".", "precision", ";", "optionally", "using", "opt", ".", "subdivisions", "provided", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/src/geometry.js#L2027-L2045
7,837
clientIO/joint
src/geometry.js
function(index, arg) { var segments = this.segments; var numSegments = segments.length; if (numSegments === 0) throw new Error('Path has no segments.'); if (index < 0) index = numSegments + index; // convert negative indices to positive if (index >= numSegments || index < 0) th...
javascript
function(index, arg) { var segments = this.segments; var numSegments = segments.length; if (numSegments === 0) throw new Error('Path has no segments.'); if (index < 0) index = numSegments + index; // convert negative indices to positive if (index >= numSegments || index < 0) th...
[ "function", "(", "index", ",", "arg", ")", "{", "var", "segments", "=", "this", ".", "segments", ";", "var", "numSegments", "=", "segments", ".", "length", ";", "if", "(", "numSegments", "===", "0", ")", "throw", "new", "Error", "(", "'Path has no segmen...
Replace the segment at `index` with `arg`. Accepts negative indices, from `-1` to `-segments.length`. Accepts one segment or an array of segments as argument. Throws an error if path has no segments. Throws an error if index is out of range. Throws an error if argument is not a segment or an array of segments.
[ "Replace", "the", "segment", "at", "index", "with", "arg", ".", "Accepts", "negative", "indices", "from", "-", "1", "to", "-", "segments", ".", "length", ".", "Accepts", "one", "segment", "or", "an", "array", "of", "segments", "as", "argument", ".", "Thr...
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/src/geometry.js#L2539-L2589
7,838
clientIO/joint
demo/expand/index.js
function(cell, portId) { console.assert(cell.isVisible()); console.assert(!cell.portProp(portId, 'collapsed'), 'port ' + portId + ' on ' + cell.id + ' should be expanded'); }
javascript
function(cell, portId) { console.assert(cell.isVisible()); console.assert(!cell.portProp(portId, 'collapsed'), 'port ' + portId + ' on ' + cell.id + ' should be expanded'); }
[ "function", "(", "cell", ",", "portId", ")", "{", "console", ".", "assert", "(", "cell", ".", "isVisible", "(", ")", ")", ";", "console", ".", "assert", "(", "!", "cell", ".", "portProp", "(", "portId", ",", "'collapsed'", ")", ",", "'port '", "+", ...
Simple unit testing
[ "Simple", "unit", "testing" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/demo/expand/index.js#L198-L202
7,839
Mikhus/canvas-gauges
lib/RadialGauge.js
displayValue
function displayValue(gauge) { if (gauge.options.animatedValue) { return gauge.options.value; } return gauge.value; }
javascript
function displayValue(gauge) { if (gauge.options.animatedValue) { return gauge.options.value; } return gauge.value; }
[ "function", "displayValue", "(", "gauge", ")", "{", "if", "(", "gauge", ".", "options", ".", "animatedValue", ")", "{", "return", "gauge", ".", "options", ".", "value", ";", "}", "return", "gauge", ".", "value", ";", "}" ]
Find and return gauge value to display @param {RadialGauge} gauge
[ "Find", "and", "return", "gauge", "value", "to", "display" ]
8f1a0936951be63f612e16443eb7b2235863679e
https://github.com/Mikhus/canvas-gauges/blob/8f1a0936951be63f612e16443eb7b2235863679e/lib/RadialGauge.js#L683-L689
7,840
Mikhus/canvas-gauges
lib/LinearGauge.js
drawLinearBar
function drawLinearBar(context, options, x, y, w, h) { drawLinearBarShape(context, options, '', x, y, w, h); }
javascript
function drawLinearBar(context, options, x, y, w, h) { drawLinearBarShape(context, options, '', x, y, w, h); }
[ "function", "drawLinearBar", "(", "context", ",", "options", ",", "x", ",", "y", ",", "w", ",", "h", ")", "{", "drawLinearBarShape", "(", "context", ",", "options", ",", "''", ",", "x", ",", "y", ",", "w", ",", "h", ")", ";", "}" ]
Draws gauge bar @param {Canvas2DContext} context @param {LinearGaugeOptions} options @param {number} x x-coordinate of the top-left corner of the gauge @param {number} y y-coordinate of the top-left corner of the gauge @param {number} w width of the gauge @param {number} h height of the gauge
[ "Draws", "gauge", "bar" ]
8f1a0936951be63f612e16443eb7b2235863679e
https://github.com/Mikhus/canvas-gauges/blob/8f1a0936951be63f612e16443eb7b2235863679e/lib/LinearGauge.js#L467-L469
7,841
Teradata/covalent
scripts/version-placeholders.js
replaceVersionPlaceholders
function replaceVersionPlaceholders(packageDir, projectVersion) { // Resolve files that contain version placeholders using Grep or Findstr since those are // extremely fast and also have a very simple usage. const files = findFilesWithPlaceholders(packageDir); // Walk through every file that contains version p...
javascript
function replaceVersionPlaceholders(packageDir, projectVersion) { // Resolve files that contain version placeholders using Grep or Findstr since those are // extremely fast and also have a very simple usage. const files = findFilesWithPlaceholders(packageDir); // Walk through every file that contains version p...
[ "function", "replaceVersionPlaceholders", "(", "packageDir", ",", "projectVersion", ")", "{", "// Resolve files that contain version placeholders using Grep or Findstr since those are", "// extremely fast and also have a very simple usage.", "const", "files", "=", "findFilesWithPlaceholder...
Walks through every file in a directory and replaces the version placeholders
[ "Walks", "through", "every", "file", "in", "a", "directory", "and", "replaces", "the", "version", "placeholders" ]
75e047408b21b95689b669b8851c41dd3f844204
https://github.com/Teradata/covalent/blob/75e047408b21b95689b669b8851c41dd3f844204/scripts/version-placeholders.js#L28-L43
7,842
Teradata/covalent
scripts/version-placeholders.js
findFilesWithPlaceholders
function findFilesWithPlaceholders(packageDir) { const findCommand = buildPlaceholderFindCommand(packageDir); return spawnSync(findCommand.binary, findCommand.args).stdout .toString() .split(/[\n\r]/) .filter(String); }
javascript
function findFilesWithPlaceholders(packageDir) { const findCommand = buildPlaceholderFindCommand(packageDir); return spawnSync(findCommand.binary, findCommand.args).stdout .toString() .split(/[\n\r]/) .filter(String); }
[ "function", "findFilesWithPlaceholders", "(", "packageDir", ")", "{", "const", "findCommand", "=", "buildPlaceholderFindCommand", "(", "packageDir", ")", ";", "return", "spawnSync", "(", "findCommand", ".", "binary", ",", "findCommand", ".", "args", ")", ".", "std...
Finds all files in the specified package dir where version placeholders are included.
[ "Finds", "all", "files", "in", "the", "specified", "package", "dir", "where", "version", "placeholders", "are", "included", "." ]
75e047408b21b95689b669b8851c41dd3f844204
https://github.com/Teradata/covalent/blob/75e047408b21b95689b669b8851c41dd3f844204/scripts/version-placeholders.js#L46-L52
7,843
Teradata/covalent
scripts/version-placeholders.js
buildPlaceholderFindCommand
function buildPlaceholderFindCommand(packageDir) { if (platform() === 'win32') { return { binary: 'findstr', args: ['/msi', `${materialVersionPlaceholderText} ${ngVersionPlaceholderText} ${versionPlaceholderText}`, `${packageDir}\\*`] }; } else { return { binary: 'grep', args: ['...
javascript
function buildPlaceholderFindCommand(packageDir) { if (platform() === 'win32') { return { binary: 'findstr', args: ['/msi', `${materialVersionPlaceholderText} ${ngVersionPlaceholderText} ${versionPlaceholderText}`, `${packageDir}\\*`] }; } else { return { binary: 'grep', args: ['...
[ "function", "buildPlaceholderFindCommand", "(", "packageDir", ")", "{", "if", "(", "platform", "(", ")", "===", "'win32'", ")", "{", "return", "{", "binary", ":", "'findstr'", ",", "args", ":", "[", "'/msi'", ",", "`", "${", "materialVersionPlaceholderText", ...
Builds the command that will be executed to find all files containing version placeholders.
[ "Builds", "the", "command", "that", "will", "be", "executed", "to", "find", "all", "files", "containing", "version", "placeholders", "." ]
75e047408b21b95689b669b8851c41dd3f844204
https://github.com/Teradata/covalent/blob/75e047408b21b95689b669b8851c41dd3f844204/scripts/version-placeholders.js#L55-L67
7,844
exokitxr/exokit
src/DOM.js
_cloneNode
function _cloneNode(deep, sourceNode, parentNode) { const clone = new sourceNode.constructor(sourceNode[symbols.windowSymbol]); clone.attrs = sourceNode.attrs; clone.tagName = sourceNode.tagName; clone.value = sourceNode.value; // Link the parent. if (parentNode) { clone.parentNode = parentNode; } // Co...
javascript
function _cloneNode(deep, sourceNode, parentNode) { const clone = new sourceNode.constructor(sourceNode[symbols.windowSymbol]); clone.attrs = sourceNode.attrs; clone.tagName = sourceNode.tagName; clone.value = sourceNode.value; // Link the parent. if (parentNode) { clone.parentNode = parentNode; } // Co...
[ "function", "_cloneNode", "(", "deep", ",", "sourceNode", ",", "parentNode", ")", "{", "const", "clone", "=", "new", "sourceNode", ".", "constructor", "(", "sourceNode", "[", "symbols", ".", "windowSymbol", "]", ")", ";", "clone", ".", "attrs", "=", "sourc...
Clone node. Internal function to not expose the `sourceNode` and `parentNode` args used to facilitate recursive cloning. @param {boolean} deep - Recursive. @param {object} sourceNode - Node to clone. @param {parentNode} parentNode - Used for recursive cloning to attach parent.
[ "Clone", "node", ".", "Internal", "function", "to", "not", "expose", "the", "sourceNode", "and", "parentNode", "args", "used", "to", "facilitate", "recursive", "cloning", "." ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/src/DOM.js#L270-L289
7,845
exokitxr/exokit
examples/FBXLoader.js
function () { var images = {}; var blobs = {}; if ( 'Video' in fbxTree.Objects ) { var videoNodes = fbxTree.Objects.Video; for ( var nodeID in videoNodes ) { var videoNode = videoNodes[ nodeID ]; var id = parseInt( nodeID ); images[ id ] = videoNode.RelativeFilename || videoNode.F...
javascript
function () { var images = {}; var blobs = {}; if ( 'Video' in fbxTree.Objects ) { var videoNodes = fbxTree.Objects.Video; for ( var nodeID in videoNodes ) { var videoNode = videoNodes[ nodeID ]; var id = parseInt( nodeID ); images[ id ] = videoNode.RelativeFilename || videoNode.F...
[ "function", "(", ")", "{", "var", "images", "=", "{", "}", ";", "var", "blobs", "=", "{", "}", ";", "if", "(", "'Video'", "in", "fbxTree", ".", "Objects", ")", "{", "var", "videoNodes", "=", "fbxTree", ".", "Objects", ".", "Video", ";", "for", "(...
Parse FBXTree.Objects.Video for embedded image data These images are connected to textures in FBXTree.Objects.Textures via FBXTree.Connections.
[ "Parse", "FBXTree", ".", "Objects", ".", "Video", "for", "embedded", "image", "data", "These", "images", "are", "connected", "to", "textures", "in", "FBXTree", ".", "Objects", ".", "Textures", "via", "FBXTree", ".", "Connections", "." ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L190-L238
7,846
exokitxr/exokit
examples/FBXLoader.js
function ( videoNode ) { var content = videoNode.Content; var fileName = videoNode.RelativeFilename || videoNode.Filename; var extension = fileName.slice( fileName.lastIndexOf( '.' ) + 1 ).toLowerCase(); var type; switch ( extension ) { case 'bmp': type = 'image/bmp'; break; case ...
javascript
function ( videoNode ) { var content = videoNode.Content; var fileName = videoNode.RelativeFilename || videoNode.Filename; var extension = fileName.slice( fileName.lastIndexOf( '.' ) + 1 ).toLowerCase(); var type; switch ( extension ) { case 'bmp': type = 'image/bmp'; break; case ...
[ "function", "(", "videoNode", ")", "{", "var", "content", "=", "videoNode", ".", "Content", ";", "var", "fileName", "=", "videoNode", ".", "RelativeFilename", "||", "videoNode", ".", "Filename", ";", "var", "extension", "=", "fileName", ".", "slice", "(", ...
Parse embedded image data in FBXTree.Video.Content
[ "Parse", "embedded", "image", "data", "in", "FBXTree", ".", "Video", ".", "Content" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L241-L310
7,847
exokitxr/exokit
examples/FBXLoader.js
function ( images ) { var textureMap = new Map(); if ( 'Texture' in fbxTree.Objects ) { var textureNodes = fbxTree.Objects.Texture; for ( var nodeID in textureNodes ) { var texture = this.parseTexture( textureNodes[ nodeID ], images ); textureMap.set( parseInt( nodeID ), texture ); } ...
javascript
function ( images ) { var textureMap = new Map(); if ( 'Texture' in fbxTree.Objects ) { var textureNodes = fbxTree.Objects.Texture; for ( var nodeID in textureNodes ) { var texture = this.parseTexture( textureNodes[ nodeID ], images ); textureMap.set( parseInt( nodeID ), texture ); } ...
[ "function", "(", "images", ")", "{", "var", "textureMap", "=", "new", "Map", "(", ")", ";", "if", "(", "'Texture'", "in", "fbxTree", ".", "Objects", ")", "{", "var", "textureNodes", "=", "fbxTree", ".", "Objects", ".", "Texture", ";", "for", "(", "va...
Parse nodes in FBXTree.Objects.Texture These contain details such as UV scaling, cropping, rotation etc and are connected to images in FBXTree.Objects.Video
[ "Parse", "nodes", "in", "FBXTree", ".", "Objects", ".", "Texture", "These", "contain", "details", "such", "as", "UV", "scaling", "cropping", "rotation", "etc", "and", "are", "connected", "to", "images", "in", "FBXTree", ".", "Objects", ".", "Video" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L315-L333
7,848
exokitxr/exokit
examples/FBXLoader.js
function ( textureNode, images ) { var texture = this.loadTexture( textureNode, images ); texture.ID = textureNode.id; texture.name = textureNode.attrName; var wrapModeU = textureNode.WrapModeU; var wrapModeV = textureNode.WrapModeV; var valueU = wrapModeU !== undefined ? wrapModeU.value : 0; ...
javascript
function ( textureNode, images ) { var texture = this.loadTexture( textureNode, images ); texture.ID = textureNode.id; texture.name = textureNode.attrName; var wrapModeU = textureNode.WrapModeU; var wrapModeV = textureNode.WrapModeV; var valueU = wrapModeU !== undefined ? wrapModeU.value : 0; ...
[ "function", "(", "textureNode", ",", "images", ")", "{", "var", "texture", "=", "this", ".", "loadTexture", "(", "textureNode", ",", "images", ")", ";", "texture", ".", "ID", "=", "textureNode", ".", "id", ";", "texture", ".", "name", "=", "textureNode",...
Parse individual node in FBXTree.Objects.Texture
[ "Parse", "individual", "node", "in", "FBXTree", ".", "Objects", ".", "Texture" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L336-L367
7,849
exokitxr/exokit
examples/FBXLoader.js
function ( textureNode, images ) { var fileName; var currentPath = this.textureLoader.path; var children = connections.get( textureNode.id ).children; if ( children !== undefined && children.length > 0 && images[ children[ 0 ].ID ] !== undefined ) { fileName = images[ children[ 0 ].ID ]; if ( ...
javascript
function ( textureNode, images ) { var fileName; var currentPath = this.textureLoader.path; var children = connections.get( textureNode.id ).children; if ( children !== undefined && children.length > 0 && images[ children[ 0 ].ID ] !== undefined ) { fileName = images[ children[ 0 ].ID ]; if ( ...
[ "function", "(", "textureNode", ",", "images", ")", "{", "var", "fileName", ";", "var", "currentPath", "=", "this", ".", "textureLoader", ".", "path", ";", "var", "children", "=", "connections", ".", "get", "(", "textureNode", ".", "id", ")", ".", "child...
load a texture specified as a blob or data URI, or via an external URL using THREE.TextureLoader
[ "load", "a", "texture", "specified", "as", "a", "blob", "or", "data", "URI", "or", "via", "an", "external", "URL", "using", "THREE", ".", "TextureLoader" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L370-L424
7,850
exokitxr/exokit
examples/FBXLoader.js
function ( textureMap ) { var materialMap = new Map(); if ( 'Material' in fbxTree.Objects ) { var materialNodes = fbxTree.Objects.Material; for ( var nodeID in materialNodes ) { var material = this.parseMaterial( materialNodes[ nodeID ], textureMap ); if ( material !== null ) materialMap.s...
javascript
function ( textureMap ) { var materialMap = new Map(); if ( 'Material' in fbxTree.Objects ) { var materialNodes = fbxTree.Objects.Material; for ( var nodeID in materialNodes ) { var material = this.parseMaterial( materialNodes[ nodeID ], textureMap ); if ( material !== null ) materialMap.s...
[ "function", "(", "textureMap", ")", "{", "var", "materialMap", "=", "new", "Map", "(", ")", ";", "if", "(", "'Material'", "in", "fbxTree", ".", "Objects", ")", "{", "var", "materialNodes", "=", "fbxTree", ".", "Objects", ".", "Material", ";", "for", "(...
Parse nodes in FBXTree.Objects.Material
[ "Parse", "nodes", "in", "FBXTree", ".", "Objects", ".", "Material" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L427-L447
7,851
exokitxr/exokit
examples/FBXLoader.js
function ( materialNode, textureMap ) { var ID = materialNode.id; var name = materialNode.attrName; var type = materialNode.ShadingModel; // Case where FBX wraps shading model in property object. if ( typeof type === 'object' ) { type = type.value; } // Ignore unused materials which don't ...
javascript
function ( materialNode, textureMap ) { var ID = materialNode.id; var name = materialNode.attrName; var type = materialNode.ShadingModel; // Case where FBX wraps shading model in property object. if ( typeof type === 'object' ) { type = type.value; } // Ignore unused materials which don't ...
[ "function", "(", "materialNode", ",", "textureMap", ")", "{", "var", "ID", "=", "materialNode", ".", "id", ";", "var", "name", "=", "materialNode", ".", "attrName", ";", "var", "type", "=", "materialNode", ".", "ShadingModel", ";", "// Case where FBX wraps sha...
Parse single node in FBXTree.Objects.Material Materials are connected to texture maps in FBXTree.Objects.Textures FBX format currently only supports Lambert and Phong shading models
[ "Parse", "single", "node", "in", "FBXTree", ".", "Objects", ".", "Material", "Materials", "are", "connected", "to", "texture", "maps", "in", "FBXTree", ".", "Objects", ".", "Textures", "FBX", "format", "currently", "only", "supports", "Lambert", "and", "Phong"...
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L452-L492
7,852
exokitxr/exokit
examples/FBXLoader.js
function ( textureMap, id ) { // if the texture is a layered texture, just use the first layer and issue a warning if ( 'LayeredTexture' in fbxTree.Objects && id in fbxTree.Objects.LayeredTexture ) { console.warn( 'THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first lay...
javascript
function ( textureMap, id ) { // if the texture is a layered texture, just use the first layer and issue a warning if ( 'LayeredTexture' in fbxTree.Objects && id in fbxTree.Objects.LayeredTexture ) { console.warn( 'THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first lay...
[ "function", "(", "textureMap", ",", "id", ")", "{", "// if the texture is a layered texture, just use the first layer and issue a warning", "if", "(", "'LayeredTexture'", "in", "fbxTree", ".", "Objects", "&&", "id", "in", "fbxTree", ".", "Objects", ".", "LayeredTexture", ...
get a texture from the textureMap for use by a material.
[ "get", "a", "texture", "from", "the", "textureMap", "for", "use", "by", "a", "material", "." ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L625-L637
7,853
exokitxr/exokit
examples/FBXLoader.js
function () { var skeletons = {}; var morphTargets = {}; if ( 'Deformer' in fbxTree.Objects ) { var DeformerNodes = fbxTree.Objects.Deformer; for ( var nodeID in DeformerNodes ) { var deformerNode = DeformerNodes[ nodeID ]; var relationships = connections.get( parseInt( nodeID ) ); ...
javascript
function () { var skeletons = {}; var morphTargets = {}; if ( 'Deformer' in fbxTree.Objects ) { var DeformerNodes = fbxTree.Objects.Deformer; for ( var nodeID in DeformerNodes ) { var deformerNode = DeformerNodes[ nodeID ]; var relationships = connections.get( parseInt( nodeID ) ); ...
[ "function", "(", ")", "{", "var", "skeletons", "=", "{", "}", ";", "var", "morphTargets", "=", "{", "}", ";", "if", "(", "'Deformer'", "in", "fbxTree", ".", "Objects", ")", "{", "var", "DeformerNodes", "=", "fbxTree", ".", "Objects", ".", "Deformer", ...
Parse nodes in FBXTree.Objects.Deformer Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here Generates map of Skeleton-like objects for use later when generating and binding skeletons.
[ "Parse", "nodes", "in", "FBXTree", ".", "Objects", ".", "Deformer", "Deformer", "node", "can", "contain", "skinning", "or", "Vertex", "Cache", "animation", "data", "however", "only", "skinning", "is", "supported", "here", "Generates", "map", "of", "Skeleton", ...
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L642-L693
7,854
exokitxr/exokit
examples/FBXLoader.js
function ( relationships, deformerNodes ) { var rawBones = []; relationships.children.forEach( function ( child ) { var boneNode = deformerNodes[ child.ID ]; if ( boneNode.attrType !== 'Cluster' ) return; var rawBone = { ID: child.ID, indices: [], weights: [], transform: new ...
javascript
function ( relationships, deformerNodes ) { var rawBones = []; relationships.children.forEach( function ( child ) { var boneNode = deformerNodes[ child.ID ]; if ( boneNode.attrType !== 'Cluster' ) return; var rawBone = { ID: child.ID, indices: [], weights: [], transform: new ...
[ "function", "(", "relationships", ",", "deformerNodes", ")", "{", "var", "rawBones", "=", "[", "]", ";", "relationships", ".", "children", ".", "forEach", "(", "function", "(", "child", ")", "{", "var", "boneNode", "=", "deformerNodes", "[", "child", ".", ...
Parse single nodes in FBXTree.Objects.Deformer The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster' Each skin node represents a skeleton and each cluster node represents a bone
[ "Parse", "single", "nodes", "in", "FBXTree", ".", "Objects", ".", "Deformer", "The", "top", "level", "skeleton", "node", "has", "type", "Skin", "and", "sub", "nodes", "have", "type", "Cluster", "Each", "skin", "node", "represents", "a", "skeleton", "and", ...
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L698-L737
7,855
exokitxr/exokit
examples/FBXLoader.js
function ( relationships, deformerNodes ) { var rawMorphTargets = []; for ( var i = 0; i < relationships.children.length; i ++ ) { if ( i === 8 ) { console.warn( 'FBXLoader: maximum of 8 morph targets supported. Ignoring additional targets.' ); break; } var child = relationships.child...
javascript
function ( relationships, deformerNodes ) { var rawMorphTargets = []; for ( var i = 0; i < relationships.children.length; i ++ ) { if ( i === 8 ) { console.warn( 'FBXLoader: maximum of 8 morph targets supported. Ignoring additional targets.' ); break; } var child = relationships.child...
[ "function", "(", "relationships", ",", "deformerNodes", ")", "{", "var", "rawMorphTargets", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "relationships", ".", "children", ".", "length", ";", "i", "++", ")", "{", "if", "(", "...
The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel"
[ "The", "top", "level", "morph", "deformer", "node", "has", "type", "BlendShape", "and", "sub", "nodes", "have", "type", "BlendShapeChannel" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L740-L783
7,856
exokitxr/exokit
examples/FBXLoader.js
function ( skeletons, geometryMap, materialMap ) { var modelMap = new Map(); var modelNodes = fbxTree.Objects.Model; for ( var nodeID in modelNodes ) { var id = parseInt( nodeID ); var node = modelNodes[ nodeID ]; var relationships = connections.get( id ); var model = this.buildSkeleton( re...
javascript
function ( skeletons, geometryMap, materialMap ) { var modelMap = new Map(); var modelNodes = fbxTree.Objects.Model; for ( var nodeID in modelNodes ) { var id = parseInt( nodeID ); var node = modelNodes[ nodeID ]; var relationships = connections.get( id ); var model = this.buildSkeleton( re...
[ "function", "(", "skeletons", ",", "geometryMap", ",", "materialMap", ")", "{", "var", "modelMap", "=", "new", "Map", "(", ")", ";", "var", "modelNodes", "=", "fbxTree", ".", "Objects", ".", "Model", ";", "for", "(", "var", "nodeID", "in", "modelNodes", ...
parse nodes in FBXTree.Objects.Model
[ "parse", "nodes", "in", "FBXTree", ".", "Objects", ".", "Model" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L839-L888
7,857
exokitxr/exokit
examples/FBXLoader.js
function ( relationships ) { var model; var cameraAttribute; relationships.children.forEach( function ( child ) { var attr = fbxTree.Objects.NodeAttribute[ child.ID ]; if ( attr !== undefined ) { cameraAttribute = attr; } } ); if ( cameraAttribute === undefined ) { model = n...
javascript
function ( relationships ) { var model; var cameraAttribute; relationships.children.forEach( function ( child ) { var attr = fbxTree.Objects.NodeAttribute[ child.ID ]; if ( attr !== undefined ) { cameraAttribute = attr; } } ); if ( cameraAttribute === undefined ) { model = n...
[ "function", "(", "relationships", ")", "{", "var", "model", ";", "var", "cameraAttribute", ";", "relationships", ".", "children", ".", "forEach", "(", "function", "(", "child", ")", "{", "var", "attr", "=", "fbxTree", ".", "Objects", ".", "NodeAttribute", ...
create a THREE.PerspectiveCamera or THREE.OrthographicCamera
[ "create", "a", "THREE", ".", "PerspectiveCamera", "or", "THREE", ".", "OrthographicCamera" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L935-L1023
7,858
exokitxr/exokit
examples/FBXLoader.js
function ( relationships ) { var model; var lightAttribute; relationships.children.forEach( function ( child ) { var attr = fbxTree.Objects.NodeAttribute[ child.ID ]; if ( attr !== undefined ) { lightAttribute = attr; } } ); if ( lightAttribute === undefined ) { model = new ...
javascript
function ( relationships ) { var model; var lightAttribute; relationships.children.forEach( function ( child ) { var attr = fbxTree.Objects.NodeAttribute[ child.ID ]; if ( attr !== undefined ) { lightAttribute = attr; } } ); if ( lightAttribute === undefined ) { model = new ...
[ "function", "(", "relationships", ")", "{", "var", "model", ";", "var", "lightAttribute", ";", "relationships", ".", "children", ".", "forEach", "(", "function", "(", "child", ")", "{", "var", "attr", "=", "fbxTree", ".", "Objects", ".", "NodeAttribute", "...
Create a THREE.DirectionalLight, THREE.PointLight or THREE.SpotLight
[ "Create", "a", "THREE", ".", "DirectionalLight", "THREE", ".", "PointLight", "or", "THREE", ".", "SpotLight" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L1026-L1147
7,859
exokitxr/exokit
examples/FBXLoader.js
function ( deformers ) { var geometryMap = new Map(); if ( 'Geometry' in fbxTree.Objects ) { var geoNodes = fbxTree.Objects.Geometry; for ( var nodeID in geoNodes ) { var relationships = connections.get( parseInt( nodeID ) ); var geo = this.parseGeometry( relationships, geoNodes[ nodeID ], ...
javascript
function ( deformers ) { var geometryMap = new Map(); if ( 'Geometry' in fbxTree.Objects ) { var geoNodes = fbxTree.Objects.Geometry; for ( var nodeID in geoNodes ) { var relationships = connections.get( parseInt( nodeID ) ); var geo = this.parseGeometry( relationships, geoNodes[ nodeID ], ...
[ "function", "(", "deformers", ")", "{", "var", "geometryMap", "=", "new", "Map", "(", ")", ";", "if", "(", "'Geometry'", "in", "fbxTree", ".", "Objects", ")", "{", "var", "geoNodes", "=", "fbxTree", ".", "Objects", ".", "Geometry", ";", "for", "(", "...
Parse nodes in FBXTree.Objects.Geometry
[ "Parse", "nodes", "in", "FBXTree", ".", "Objects", ".", "Geometry" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L1433-L1454
7,860
exokitxr/exokit
examples/FBXLoader.js
function ( relationships, geoNode, deformers ) { switch ( geoNode.attrType ) { case 'Mesh': return this.parseMeshGeometry( relationships, geoNode, deformers ); break; case 'NurbsCurve': return this.parseNurbsGeometry( geoNode ); break; } }
javascript
function ( relationships, geoNode, deformers ) { switch ( geoNode.attrType ) { case 'Mesh': return this.parseMeshGeometry( relationships, geoNode, deformers ); break; case 'NurbsCurve': return this.parseNurbsGeometry( geoNode ); break; } }
[ "function", "(", "relationships", ",", "geoNode", ",", "deformers", ")", "{", "switch", "(", "geoNode", ".", "attrType", ")", "{", "case", "'Mesh'", ":", "return", "this", ".", "parseMeshGeometry", "(", "relationships", ",", "geoNode", ",", "deformers", ")",...
Parse single node in FBXTree.Objects.Geometry
[ "Parse", "single", "node", "in", "FBXTree", ".", "Objects", ".", "Geometry" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L1457-L1471
7,861
exokitxr/exokit
examples/FBXLoader.js
function ( relationships, geoNode, deformers ) { var skeletons = deformers.skeletons; var morphTargets = deformers.morphTargets; var modelNodes = relationships.parents.map( function ( parent ) { return fbxTree.Objects.Model[ parent.ID ]; } ); // don't create geometry if it is not associated with...
javascript
function ( relationships, geoNode, deformers ) { var skeletons = deformers.skeletons; var morphTargets = deformers.morphTargets; var modelNodes = relationships.parents.map( function ( parent ) { return fbxTree.Objects.Model[ parent.ID ]; } ); // don't create geometry if it is not associated with...
[ "function", "(", "relationships", ",", "geoNode", ",", "deformers", ")", "{", "var", "skeletons", "=", "deformers", ".", "skeletons", ";", "var", "morphTargets", "=", "deformers", ".", "morphTargets", ";", "var", "modelNodes", "=", "relationships", ".", "paren...
Parse single node mesh geometry in FBXTree.Objects.Geometry
[ "Parse", "single", "node", "mesh", "geometry", "in", "FBXTree", ".", "Objects", ".", "Geometry" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L1474-L1522
7,862
exokitxr/exokit
examples/FBXLoader.js
function ( geoNode, skeleton, morphTarget, preTransform ) { var geo = new THREE.BufferGeometry(); if ( geoNode.attrName ) geo.name = geoNode.attrName; var geoInfo = this.parseGeoNode( geoNode, skeleton ); var buffers = this.genBuffers( geoInfo ); var positionAttribute = new THREE.Float32BufferAttribut...
javascript
function ( geoNode, skeleton, morphTarget, preTransform ) { var geo = new THREE.BufferGeometry(); if ( geoNode.attrName ) geo.name = geoNode.attrName; var geoInfo = this.parseGeoNode( geoNode, skeleton ); var buffers = this.genBuffers( geoInfo ); var positionAttribute = new THREE.Float32BufferAttribut...
[ "function", "(", "geoNode", ",", "skeleton", ",", "morphTarget", ",", "preTransform", ")", "{", "var", "geo", "=", "new", "THREE", ".", "BufferGeometry", "(", ")", ";", "if", "(", "geoNode", ".", "attrName", ")", "geo", ".", "name", "=", "geoNode", "."...
Generate a THREE.BufferGeometry from a node in FBXTree.Objects.Geometry
[ "Generate", "a", "THREE", ".", "BufferGeometry", "from", "a", "node", "in", "FBXTree", ".", "Objects", ".", "Geometry" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L1525-L1630
7,863
exokitxr/exokit
examples/FBXLoader.js
function ( parentGeo, parentGeoNode, morphGeoNode, preTransform ) { var morphGeo = new THREE.BufferGeometry(); if ( morphGeoNode.attrName ) morphGeo.name = morphGeoNode.attrName; var vertexIndices = ( parentGeoNode.PolygonVertexIndex !== undefined ) ? parentGeoNode.PolygonVertexIndex.a : []; // make a co...
javascript
function ( parentGeo, parentGeoNode, morphGeoNode, preTransform ) { var morphGeo = new THREE.BufferGeometry(); if ( morphGeoNode.attrName ) morphGeo.name = morphGeoNode.attrName; var vertexIndices = ( parentGeoNode.PolygonVertexIndex !== undefined ) ? parentGeoNode.PolygonVertexIndex.a : []; // make a co...
[ "function", "(", "parentGeo", ",", "parentGeoNode", ",", "morphGeoNode", ",", "preTransform", ")", "{", "var", "morphGeo", "=", "new", "THREE", ".", "BufferGeometry", "(", ")", ";", "if", "(", "morphGeoNode", ".", "attrName", ")", "morphGeo", ".", "name", ...
a morph geometry node is similar to a standard node, and the node is also contained in FBXTree.Objects.Geometry, however it can only have attributes for position, normal and a special attribute Index defining which vertices of the original geometry are affected Normal and position attributes only have data for the ver...
[ "a", "morph", "geometry", "node", "is", "similar", "to", "a", "standard", "node", "and", "the", "node", "is", "also", "contained", "in", "FBXTree", ".", "Objects", ".", "Geometry", "however", "it", "can", "only", "have", "attributes", "for", "position", "n...
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2025-L2065
7,864
exokitxr/exokit
examples/FBXLoader.js
function ( NormalNode ) { var mappingType = NormalNode.MappingInformationType; var referenceType = NormalNode.ReferenceInformationType; var buffer = NormalNode.Normals.a; var indexBuffer = []; if ( referenceType === 'IndexToDirect' ) { if ( 'NormalIndex' in NormalNode ) { indexBuffer = Normal...
javascript
function ( NormalNode ) { var mappingType = NormalNode.MappingInformationType; var referenceType = NormalNode.ReferenceInformationType; var buffer = NormalNode.Normals.a; var indexBuffer = []; if ( referenceType === 'IndexToDirect' ) { if ( 'NormalIndex' in NormalNode ) { indexBuffer = Normal...
[ "function", "(", "NormalNode", ")", "{", "var", "mappingType", "=", "NormalNode", ".", "MappingInformationType", ";", "var", "referenceType", "=", "NormalNode", ".", "ReferenceInformationType", ";", "var", "buffer", "=", "NormalNode", ".", "Normals", ".", "a", "...
Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
[ "Parse", "normal", "from", "FBXTree", ".", "Objects", ".", "Geometry", ".", "LayerElementNormal", "if", "it", "exists" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2068-L2096
7,865
exokitxr/exokit
examples/FBXLoader.js
function ( UVNode ) { var mappingType = UVNode.MappingInformationType; var referenceType = UVNode.ReferenceInformationType; var buffer = UVNode.UV.a; var indexBuffer = []; if ( referenceType === 'IndexToDirect' ) { indexBuffer = UVNode.UVIndex.a; } return { dataSize: 2, buffer: buff...
javascript
function ( UVNode ) { var mappingType = UVNode.MappingInformationType; var referenceType = UVNode.ReferenceInformationType; var buffer = UVNode.UV.a; var indexBuffer = []; if ( referenceType === 'IndexToDirect' ) { indexBuffer = UVNode.UVIndex.a; } return { dataSize: 2, buffer: buff...
[ "function", "(", "UVNode", ")", "{", "var", "mappingType", "=", "UVNode", ".", "MappingInformationType", ";", "var", "referenceType", "=", "UVNode", ".", "ReferenceInformationType", ";", "var", "buffer", "=", "UVNode", ".", "UV", ".", "a", ";", "var", "index...
Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists
[ "Parse", "UVs", "from", "FBXTree", ".", "Objects", ".", "Geometry", ".", "LayerElementUV", "if", "it", "exists" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2099-L2119
7,866
exokitxr/exokit
examples/FBXLoader.js
function ( ColorNode ) { var mappingType = ColorNode.MappingInformationType; var referenceType = ColorNode.ReferenceInformationType; var buffer = ColorNode.Colors.a; var indexBuffer = []; if ( referenceType === 'IndexToDirect' ) { indexBuffer = ColorNode.ColorIndex.a; } return { dataSiz...
javascript
function ( ColorNode ) { var mappingType = ColorNode.MappingInformationType; var referenceType = ColorNode.ReferenceInformationType; var buffer = ColorNode.Colors.a; var indexBuffer = []; if ( referenceType === 'IndexToDirect' ) { indexBuffer = ColorNode.ColorIndex.a; } return { dataSiz...
[ "function", "(", "ColorNode", ")", "{", "var", "mappingType", "=", "ColorNode", ".", "MappingInformationType", ";", "var", "referenceType", "=", "ColorNode", ".", "ReferenceInformationType", ";", "var", "buffer", "=", "ColorNode", ".", "Colors", ".", "a", ";", ...
Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists
[ "Parse", "Vertex", "Colors", "from", "FBXTree", ".", "Objects", ".", "Geometry", ".", "LayerElementColor", "if", "it", "exists" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2122-L2142
7,867
exokitxr/exokit
examples/FBXLoader.js
function ( MaterialNode ) { var mappingType = MaterialNode.MappingInformationType; var referenceType = MaterialNode.ReferenceInformationType; if ( mappingType === 'NoMappingInformation' ) { return { dataSize: 1, buffer: [ 0 ], indices: [ 0 ], mappingType: 'AllSame', referenceTyp...
javascript
function ( MaterialNode ) { var mappingType = MaterialNode.MappingInformationType; var referenceType = MaterialNode.ReferenceInformationType; if ( mappingType === 'NoMappingInformation' ) { return { dataSize: 1, buffer: [ 0 ], indices: [ 0 ], mappingType: 'AllSame', referenceTyp...
[ "function", "(", "MaterialNode", ")", "{", "var", "mappingType", "=", "MaterialNode", ".", "MappingInformationType", ";", "var", "referenceType", "=", "MaterialNode", ".", "ReferenceInformationType", ";", "if", "(", "mappingType", "===", "'NoMappingInformation'", ")",...
Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists
[ "Parse", "mapping", "and", "material", "data", "in", "FBXTree", ".", "Objects", ".", "Geometry", ".", "LayerElementMaterial", "if", "it", "exists" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2145-L2183
7,868
exokitxr/exokit
examples/FBXLoader.js
function ( geoNode ) { if ( THREE.NURBSCurve === undefined ) { console.error( 'THREE.FBXLoader: The loader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry.' ); return new THREE.BufferGeometry(); } var order = parseInt( geoNode.Order ); if ( is...
javascript
function ( geoNode ) { if ( THREE.NURBSCurve === undefined ) { console.error( 'THREE.FBXLoader: The loader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry.' ); return new THREE.BufferGeometry(); } var order = parseInt( geoNode.Order ); if ( is...
[ "function", "(", "geoNode", ")", "{", "if", "(", "THREE", ".", "NURBSCurve", "===", "undefined", ")", "{", "console", ".", "error", "(", "'THREE.FBXLoader: The loader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry.'", ")", ...
Generate a NurbGeometry from a node in FBXTree.Objects.Geometry
[ "Generate", "a", "NurbGeometry", "from", "a", "node", "in", "FBXTree", ".", "Objects", ".", "Geometry" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2186-L2251
7,869
exokitxr/exokit
examples/FBXLoader.js
function () { var animationClips = []; var rawClips = this.parseClips(); if ( rawClips === undefined ) return; for ( var key in rawClips ) { var rawClip = rawClips[ key ]; var clip = this.addClip( rawClip ); animationClips.push( clip ); } return animationClips; }
javascript
function () { var animationClips = []; var rawClips = this.parseClips(); if ( rawClips === undefined ) return; for ( var key in rawClips ) { var rawClip = rawClips[ key ]; var clip = this.addClip( rawClip ); animationClips.push( clip ); } return animationClips; }
[ "function", "(", ")", "{", "var", "animationClips", "=", "[", "]", ";", "var", "rawClips", "=", "this", ".", "parseClips", "(", ")", ";", "if", "(", "rawClips", "===", "undefined", ")", "return", ";", "for", "(", "var", "key", "in", "rawClips", ")", ...
take raw animation clips and turn them into three.js animation clips
[ "take", "raw", "animation", "clips", "and", "turn", "them", "into", "three", ".", "js", "animation", "clips" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2263-L2284
7,870
exokitxr/exokit
examples/FBXLoader.js
function ( layersMap ) { var rawStacks = fbxTree.Objects.AnimationStack; // connect the stacks (clips) up to the layers var rawClips = {}; for ( var nodeID in rawStacks ) { var children = connections.get( parseInt( nodeID ) ).children; if ( children.length > 1 ) { // it seems like stacks ...
javascript
function ( layersMap ) { var rawStacks = fbxTree.Objects.AnimationStack; // connect the stacks (clips) up to the layers var rawClips = {}; for ( var nodeID in rawStacks ) { var children = connections.get( parseInt( nodeID ) ).children; if ( children.length > 1 ) { // it seems like stacks ...
[ "function", "(", "layersMap", ")", "{", "var", "rawStacks", "=", "fbxTree", ".", "Objects", ".", "AnimationStack", ";", "// connect the stacks (clips) up to the layers", "var", "rawClips", "=", "{", "}", ";", "for", "(", "var", "nodeID", "in", "rawStacks", ")", ...
parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation hierarchy. Each Stack node will be used to create a THREE.AnimationClip
[ "parse", "nodes", "in", "FBXTree", ".", "Objects", ".", "AnimationStack", ".", "These", "are", "the", "top", "level", "node", "in", "the", "animation", "hierarchy", ".", "Each", "Stack", "node", "will", "be", "used", "to", "create", "a", "THREE", ".", "A...
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2525-L2557
7,871
exokitxr/exokit
examples/FBXLoader.js
function ( curves ) { var times = []; // first join together the times for each axis, if defined if ( curves.x !== undefined ) times = times.concat( curves.x.times ); if ( curves.y !== undefined ) times = times.concat( curves.y.times ); if ( curves.z !== undefined ) times = times.concat( curves.z.times...
javascript
function ( curves ) { var times = []; // first join together the times for each axis, if defined if ( curves.x !== undefined ) times = times.concat( curves.x.times ); if ( curves.y !== undefined ) times = times.concat( curves.y.times ); if ( curves.z !== undefined ) times = times.concat( curves.z.times...
[ "function", "(", "curves", ")", "{", "var", "times", "=", "[", "]", ";", "// first join together the times for each axis, if defined", "if", "(", "curves", ".", "x", "!==", "undefined", ")", "times", "=", "times", ".", "concat", "(", "curves", ".", "x", ".",...
For all animated objects, times are defined separately for each axis Here we'll combine the times into one sorted array without duplicates
[ "For", "all", "animated", "objects", "times", "are", "defined", "separately", "for", "each", "axis", "Here", "we", "ll", "combine", "the", "times", "into", "one", "sorted", "array", "without", "duplicates" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2712-L2734
7,872
exokitxr/exokit
examples/FBXLoader.js
function ( curve ) { for ( var i = 1; i < curve.values.length; i ++ ) { var initialValue = curve.values[ i - 1 ]; var valuesSpan = curve.values[ i ] - initialValue; var absoluteSpan = Math.abs( valuesSpan ); if ( absoluteSpan >= 180 ) { var numSubIntervals = absoluteSpan / 180; var st...
javascript
function ( curve ) { for ( var i = 1; i < curve.values.length; i ++ ) { var initialValue = curve.values[ i - 1 ]; var valuesSpan = curve.values[ i ] - initialValue; var absoluteSpan = Math.abs( valuesSpan ); if ( absoluteSpan >= 180 ) { var numSubIntervals = absoluteSpan / 180; var st...
[ "function", "(", "curve", ")", "{", "for", "(", "var", "i", "=", "1", ";", "i", "<", "curve", ".", "values", ".", "length", ";", "i", "++", ")", "{", "var", "initialValue", "=", "curve", ".", "values", "[", "i", "-", "1", "]", ";", "var", "va...
Rotations are defined as Euler angles which can have values of any size These will be converted to quaternions which don't support values greater than PI, so we'll interpolate large rotations
[ "Rotations", "are", "defined", "as", "Euler", "angles", "which", "can", "have", "values", "of", "any", "size", "These", "will", "be", "converted", "to", "quaternions", "which", "don", "t", "support", "values", "greater", "than", "PI", "so", "we", "ll", "in...
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2799-L2840
7,873
exokitxr/exokit
examples/FBXLoader.js
function ( reader ) { // footer size: 160bytes + 16-byte alignment padding // - 16bytes: magic // - padding til 16-byte alignment (at least 1byte?) // (seems like some exporters embed fixed 15 or 16bytes?) // - 4bytes: magic // - 4bytes: version // - 120bytes: zero // - 16bytes: magic if ( r...
javascript
function ( reader ) { // footer size: 160bytes + 16-byte alignment padding // - 16bytes: magic // - padding til 16-byte alignment (at least 1byte?) // (seems like some exporters embed fixed 15 or 16bytes?) // - 4bytes: magic // - 4bytes: version // - 120bytes: zero // - 16bytes: magic if ( r...
[ "function", "(", "reader", ")", "{", "// footer size: 160bytes + 16-byte alignment padding", "// - 16bytes: magic", "// - padding til 16-byte alignment (at least 1byte?)", "//\t(seems like some exporters embed fixed 15 or 16bytes?)", "// - 4bytes: magic", "// - 4bytes: version", "// - 120bytes...
Check if reader has reached the end of content.
[ "Check", "if", "reader", "has", "reached", "the", "end", "of", "content", "." ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L3212-L3232
7,874
exokitxr/exokit
examples/FBXLoader.js
function ( reader, version ) { var node = {}; // The first three data sizes depends on version. var endOffset = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32(); var numProperties = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32(); // note: do not remove this even if you get ...
javascript
function ( reader, version ) { var node = {}; // The first three data sizes depends on version. var endOffset = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32(); var numProperties = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32(); // note: do not remove this even if you get ...
[ "function", "(", "reader", ",", "version", ")", "{", "var", "node", "=", "{", "}", ";", "// The first three data sizes depends on version.", "var", "endOffset", "=", "(", "version", ">=", "7500", ")", "?", "reader", ".", "getUint64", "(", ")", ":", "reader",...
recursively parse nodes until the end of the file is reached
[ "recursively", "parse", "nodes", "until", "the", "end", "of", "the", "file", "is", "reached" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L3235-L3286
7,875
exokitxr/exokit
examples/FBXLoader.js
getData
function getData( polygonVertexIndex, polygonIndex, vertexIndex, infoObject ) { var index; switch ( infoObject.mappingType ) { case 'ByPolygonVertex' : index = polygonVertexIndex; break; case 'ByPolygon' : index = polygonIndex; break; case 'ByVertice' : index = vertexIndex; break...
javascript
function getData( polygonVertexIndex, polygonIndex, vertexIndex, infoObject ) { var index; switch ( infoObject.mappingType ) { case 'ByPolygonVertex' : index = polygonVertexIndex; break; case 'ByPolygon' : index = polygonIndex; break; case 'ByVertice' : index = vertexIndex; break...
[ "function", "getData", "(", "polygonVertexIndex", ",", "polygonIndex", ",", "vertexIndex", ",", "infoObject", ")", "{", "var", "index", ";", "switch", "(", "infoObject", ".", "mappingType", ")", "{", "case", "'ByPolygonVertex'", ":", "index", "=", "polygonVertex...
extracts the data from the correct position in the FBX array based on indexing type
[ "extracts", "the", "data", "from", "the", "correct", "position", "in", "the", "FBX", "array", "based", "on", "indexing", "type" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L3836-L3866
7,876
exokitxr/exokit
examples/FBXLoader.js
parseNumberArray
function parseNumberArray( value ) { var array = value.split( ',' ).map( function ( val ) { return parseFloat( val ); } ); return array; }
javascript
function parseNumberArray( value ) { var array = value.split( ',' ).map( function ( val ) { return parseFloat( val ); } ); return array; }
[ "function", "parseNumberArray", "(", "value", ")", "{", "var", "array", "=", "value", ".", "split", "(", "','", ")", ".", "map", "(", "function", "(", "val", ")", "{", "return", "parseFloat", "(", "val", ")", ";", "}", ")", ";", "return", "array", ...
Parses comma separated list of numbers and returns them an array. Used internally by the TextParser
[ "Parses", "comma", "separated", "list", "of", "numbers", "and", "returns", "them", "an", "array", ".", "Used", "internally", "by", "the", "TextParser" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L3963-L3973
7,877
exokitxr/exokit
examples/FBXLoader.js
inject
function inject( a1, index, a2 ) { return a1.slice( 0, index ).concat( a2 ).concat( a1.slice( index ) ); }
javascript
function inject( a1, index, a2 ) { return a1.slice( 0, index ).concat( a2 ).concat( a1.slice( index ) ); }
[ "function", "inject", "(", "a1", ",", "index", ",", "a2", ")", "{", "return", "a1", ".", "slice", "(", "0", ",", "index", ")", ".", "concat", "(", "a2", ")", ".", "concat", "(", "a1", ".", "slice", "(", "index", ")", ")", ";", "}" ]
inject array a2 into array a1 at index
[ "inject", "array", "a2", "into", "array", "a1", "at", "index" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L4007-L4011
7,878
exokitxr/exokit
examples/svg-boundings.js
expandXBounds
function expandXBounds(bounds, value) { if (bounds[MIN_X] > value) bounds[MIN_X] = value;else if (bounds[MAX_X] < value) bounds[MAX_X] = value; }
javascript
function expandXBounds(bounds, value) { if (bounds[MIN_X] > value) bounds[MIN_X] = value;else if (bounds[MAX_X] < value) bounds[MAX_X] = value; }
[ "function", "expandXBounds", "(", "bounds", ",", "value", ")", "{", "if", "(", "bounds", "[", "MIN_X", "]", ">", "value", ")", "bounds", "[", "MIN_X", "]", "=", "value", ";", "else", "if", "(", "bounds", "[", "MAX_X", "]", "<", "value", ")", "bound...
expand the x-bounds, if the value lies outside the bounding box
[ "expand", "the", "x", "-", "bounds", "if", "the", "value", "lies", "outside", "the", "bounding", "box" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/svg-boundings.js#L272-L274
7,879
exokitxr/exokit
examples/svg-boundings.js
expandYBounds
function expandYBounds(bounds, value) { if (bounds[MIN_Y] > value) bounds[MIN_Y] = value;else if (bounds[MAX_Y] < value) bounds[MAX_Y] = value; }
javascript
function expandYBounds(bounds, value) { if (bounds[MIN_Y] > value) bounds[MIN_Y] = value;else if (bounds[MAX_Y] < value) bounds[MAX_Y] = value; }
[ "function", "expandYBounds", "(", "bounds", ",", "value", ")", "{", "if", "(", "bounds", "[", "MIN_Y", "]", ">", "value", ")", "bounds", "[", "MIN_Y", "]", "=", "value", ";", "else", "if", "(", "bounds", "[", "MAX_Y", "]", "<", "value", ")", "bound...
expand the y-bounds, if the value lies outside the bounding box
[ "expand", "the", "y", "-", "bounds", "if", "the", "value", "lies", "outside", "the", "bounding", "box" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/svg-boundings.js#L279-L281
7,880
exokitxr/exokit
examples/svg-boundings.js
calculateBezier
function calculateBezier(t, p0, p1, p2, p3) { var mt = 1 - t; return mt * mt * mt * p0 + 3 * mt * mt * t * p1 + 3 * mt * t * t * p2 + t * t * t * p3; }
javascript
function calculateBezier(t, p0, p1, p2, p3) { var mt = 1 - t; return mt * mt * mt * p0 + 3 * mt * mt * t * p1 + 3 * mt * t * t * p2 + t * t * t * p3; }
[ "function", "calculateBezier", "(", "t", ",", "p0", ",", "p1", ",", "p2", ",", "p3", ")", "{", "var", "mt", "=", "1", "-", "t", ";", "return", "mt", "*", "mt", "*", "mt", "*", "p0", "+", "3", "*", "mt", "*", "mt", "*", "t", "*", "p1", "+"...
Calculate the bezier value for one dimension at distance 't'
[ "Calculate", "the", "bezier", "value", "for", "one", "dimension", "at", "distance", "t" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/svg-boundings.js#L286-L289
7,881
exokitxr/exokit
examples/svg-boundings.js
function (str) { var output = []; var idx = 0; var c, num; var nextNumber = function () { var chars = []; while (/[^-\d\.]/.test(str.charAt(idx))) { // skip the non-digit characters idx++; } if ('-' === str.charAt(idx)) { chars.push('-'); idx++;...
javascript
function (str) { var output = []; var idx = 0; var c, num; var nextNumber = function () { var chars = []; while (/[^-\d\.]/.test(str.charAt(idx))) { // skip the non-digit characters idx++; } if ('-' === str.charAt(idx)) { chars.push('-'); idx++;...
[ "function", "(", "str", ")", "{", "var", "output", "=", "[", "]", ";", "var", "idx", "=", "0", ";", "var", "c", ",", "num", ";", "var", "nextNumber", "=", "function", "(", ")", "{", "var", "chars", "=", "[", "]", ";", "while", "(", "/", "[^-\...
Helper - get arguments of a path drawing command
[ "Helper", "-", "get", "arguments", "of", "a", "path", "drawing", "command" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/svg-boundings.js#L618-L647
7,882
fgnass/spin.js
Gruntfile.js
function (res, path) { let defaultSrc = "default-src 'self';"; let styleSrc = "style-src 'self' fonts.googleapis.com;"; let fontSrc = "font-src 'self' fonts.gstatic.com;"; let imgSrc = "img-src 'self' www.gravatar.com;"; res.setHeader('Cont...
javascript
function (res, path) { let defaultSrc = "default-src 'self';"; let styleSrc = "style-src 'self' fonts.googleapis.com;"; let fontSrc = "font-src 'self' fonts.gstatic.com;"; let imgSrc = "img-src 'self' www.gravatar.com;"; res.setHeader('Cont...
[ "function", "(", "res", ",", "path", ")", "{", "let", "defaultSrc", "=", "\"default-src 'self';\"", ";", "let", "styleSrc", "=", "\"style-src 'self' fonts.googleapis.com;\"", ";", "let", "fontSrc", "=", "\"font-src 'self' fonts.gstatic.com;\"", ";", "let", "imgSrc", "...
add CSP header to ensure spin.js supports it
[ "add", "CSP", "header", "to", "ensure", "spin", ".", "js", "supports", "it" ]
e693e4f933f0a5ade9498ffcbab6c1409be92681
https://github.com/fgnass/spin.js/blob/e693e4f933f0a5ade9498ffcbab6c1409be92681/Gruntfile.js#L14-L20
7,883
terkelg/prompts
lib/index.js
prompt
async function prompt(questions=[], { onSubmit=noop, onCancel=noop }={}) { const answers = {}; const override = prompt._override || {}; questions = [].concat(questions); let answer, question, quit, name, type; const getFormattedAnswer = async (question, answer, skipValidation = false) => { if (!skipValid...
javascript
async function prompt(questions=[], { onSubmit=noop, onCancel=noop }={}) { const answers = {}; const override = prompt._override || {}; questions = [].concat(questions); let answer, question, quit, name, type; const getFormattedAnswer = async (question, answer, skipValidation = false) => { if (!skipValid...
[ "async", "function", "prompt", "(", "questions", "=", "[", "]", ",", "{", "onSubmit", "=", "noop", ",", "onCancel", "=", "noop", "}", "=", "{", "}", ")", "{", "const", "answers", "=", "{", "}", ";", "const", "override", "=", "prompt", ".", "_overri...
Prompt for a series of questions @param {Array|Object} questions Single question object or Array of question objects @param {Function} [onSubmit] Callback function called on prompt submit @param {Function} [onCancel] Callback function called on cancel/abort @returns {Object} Object with values from user input
[ "Prompt", "for", "a", "series", "of", "questions" ]
496f58d4fecaf67f34685af932980b1907eda642
https://github.com/terkelg/prompts/blob/496f58d4fecaf67f34685af932980b1907eda642/lib/index.js#L15-L73
7,884
regl-project/regl
lib/texture.js
destroyTextures
function destroyTextures () { for (var i = 0; i < numTexUnits; ++i) { gl.activeTexture(GL_TEXTURE0 + i) gl.bindTexture(GL_TEXTURE_2D, null) textureUnits[i] = null } values(textureSet).forEach(destroy) stats.cubeCount = 0 stats.textureCount = 0 }
javascript
function destroyTextures () { for (var i = 0; i < numTexUnits; ++i) { gl.activeTexture(GL_TEXTURE0 + i) gl.bindTexture(GL_TEXTURE_2D, null) textureUnits[i] = null } values(textureSet).forEach(destroy) stats.cubeCount = 0 stats.textureCount = 0 }
[ "function", "destroyTextures", "(", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "numTexUnits", ";", "++", "i", ")", "{", "gl", ".", "activeTexture", "(", "GL_TEXTURE0", "+", "i", ")", "gl", ".", "bindTexture", "(", "GL_TEXTURE_2D", ","...
Called when regl is destroyed
[ "Called", "when", "regl", "is", "destroyed" ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/lib/texture.js#L1592-L1602
7,885
regl-project/regl
example/line-primitives.js
createDrawCall
function createDrawCall (props) { return regl({ attributes: { position: props.position }, uniforms: { color: props.color, scale: props.scale, offset: props.offset, phase: props.phase, freq: props.freq }, lineWidth: lineWidth, count: props.position.length, ...
javascript
function createDrawCall (props) { return regl({ attributes: { position: props.position }, uniforms: { color: props.color, scale: props.scale, offset: props.offset, phase: props.phase, freq: props.freq }, lineWidth: lineWidth, count: props.position.length, ...
[ "function", "createDrawCall", "(", "props", ")", "{", "return", "regl", "(", "{", "attributes", ":", "{", "position", ":", "props", ".", "position", "}", ",", "uniforms", ":", "{", "color", ":", "props", ".", "color", ",", "scale", ":", "props", ".", ...
this creates a drawCall that allows you to do draw single line primitive.
[ "this", "creates", "a", "drawCall", "that", "allows", "you", "to", "do", "draw", "single", "line", "primitive", "." ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/example/line-primitives.js#L69-L87
7,886
regl-project/regl
example/stencil-transition.js
centerMesh
function centerMesh (mesh) { var bb = boundingBox(mesh.positions) var _translate = [ -0.5 * (bb[0][0] + bb[1][0]), -0.5 * (bb[0][1] + bb[1][1]), -0.5 * (bb[0][2] + bb[1][2]) ] var translate = mat4.create() mat4.translate(translate, translate, _translate) mesh.positions = tform(mesh.positions, t...
javascript
function centerMesh (mesh) { var bb = boundingBox(mesh.positions) var _translate = [ -0.5 * (bb[0][0] + bb[1][0]), -0.5 * (bb[0][1] + bb[1][1]), -0.5 * (bb[0][2] + bb[1][2]) ] var translate = mat4.create() mat4.translate(translate, translate, _translate) mesh.positions = tform(mesh.positions, t...
[ "function", "centerMesh", "(", "mesh", ")", "{", "var", "bb", "=", "boundingBox", "(", "mesh", ".", "positions", ")", "var", "_translate", "=", "[", "-", "0.5", "*", "(", "bb", "[", "0", "]", "[", "0", "]", "+", "bb", "[", "1", "]", "[", "0", ...
center the rabbit mesh to the origin.
[ "center", "the", "rabbit", "mesh", "to", "the", "origin", "." ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/example/stencil-transition.js#L27-L38
7,887
regl-project/regl
example/cloth.js
Constraint
function Constraint (i0, i1) { this.i0 = i0 this.i1 = i1 this.restLength = vec3.distance(position[i0], position[i1]) }
javascript
function Constraint (i0, i1) { this.i0 = i0 this.i1 = i1 this.restLength = vec3.distance(position[i0], position[i1]) }
[ "function", "Constraint", "(", "i0", ",", "i1", ")", "{", "this", ".", "i0", "=", "i0", "this", ".", "i1", "=", "i1", "this", ".", "restLength", "=", "vec3", ".", "distance", "(", "position", "[", "i0", "]", ",", "position", "[", "i1", "]", ")", ...
create a constraint between the vertices with the indices i0 and i1.
[ "create", "a", "constraint", "between", "the", "vertices", "with", "the", "indices", "i0", "and", "i1", "." ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/example/cloth.js#L33-L38
7,888
regl-project/regl
example/graph.js
step
function step ({tick}) { setFBO({ framebuffer: FIELDS[0] }, () => { regl.clear({ color: [0, 0, 0, 1] }) splatMouse() splatVerts({ vertexState: VERTEX_STATE[(tick + 1) % 2] }) }) for (let i = 0; i < 2 * BLUR_PASSES; ++i) { blurPass({ dest: FIELDS[(i + 1) % 2], src: FIELDS[i % ...
javascript
function step ({tick}) { setFBO({ framebuffer: FIELDS[0] }, () => { regl.clear({ color: [0, 0, 0, 1] }) splatMouse() splatVerts({ vertexState: VERTEX_STATE[(tick + 1) % 2] }) }) for (let i = 0; i < 2 * BLUR_PASSES; ++i) { blurPass({ dest: FIELDS[(i + 1) % 2], src: FIELDS[i % ...
[ "function", "step", "(", "{", "tick", "}", ")", "{", "setFBO", "(", "{", "framebuffer", ":", "FIELDS", "[", "0", "]", "}", ",", "(", ")", "=>", "{", "regl", ".", "clear", "(", "{", "color", ":", "[", "0", ",", "0", ",", "0", ",", "1", "]", ...
Main integration loop
[ "Main", "integration", "loop" ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/example/graph.js#L441-L469
7,889
regl-project/regl
example/physics.js
getModelMatrix
function getModelMatrix (rb) { var ms = rb.getMotionState() if (ms) { ms.getWorldTransform(transformTemp) var p = transformTemp.getOrigin() var q = transformTemp.getRotation() return mat4.fromRotationTranslation( [], [q.x(), q.y(), q.z(), q.w()], [p.x(), p.y(), p.z()]) } }
javascript
function getModelMatrix (rb) { var ms = rb.getMotionState() if (ms) { ms.getWorldTransform(transformTemp) var p = transformTemp.getOrigin() var q = transformTemp.getRotation() return mat4.fromRotationTranslation( [], [q.x(), q.y(), q.z(), q.w()], [p.x(), p.y(), p.z()]) } }
[ "function", "getModelMatrix", "(", "rb", ")", "{", "var", "ms", "=", "rb", ".", "getMotionState", "(", ")", "if", "(", "ms", ")", "{", "ms", ".", "getWorldTransform", "(", "transformTemp", ")", "var", "p", "=", "transformTemp", ".", "getOrigin", "(", "...
extracts the model matrix from a rigid body.
[ "extracts", "the", "model", "matrix", "from", "a", "rigid", "body", "." ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/example/physics.js#L293-L304
7,890
regl-project/regl
example/pong.js
createAudioBuffer
function createAudioBuffer (length, createAudioDataCallback) { var channels = 2 var frameCount = context.sampleRate * length var audioBuffer = context.createBuffer(channels, frameCount, context.sampleRate) for (var channel = 0; channel < channels; channel++) { var channelData = audioBuffer.getChannelData(c...
javascript
function createAudioBuffer (length, createAudioDataCallback) { var channels = 2 var frameCount = context.sampleRate * length var audioBuffer = context.createBuffer(channels, frameCount, context.sampleRate) for (var channel = 0; channel < channels; channel++) { var channelData = audioBuffer.getChannelData(c...
[ "function", "createAudioBuffer", "(", "length", ",", "createAudioDataCallback", ")", "{", "var", "channels", "=", "2", "var", "frameCount", "=", "context", ".", "sampleRate", "*", "length", "var", "audioBuffer", "=", "context", ".", "createBuffer", "(", "channel...
create audio buffer that lasts `length` seconds, and `createAudioDataCallback` will will fill each of the two channels of the buffer with audio data.
[ "create", "audio", "buffer", "that", "lasts", "length", "seconds", "and", "createAudioDataCallback", "will", "will", "fill", "each", "of", "the", "two", "channels", "of", "the", "buffer", "with", "audio", "data", "." ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/example/pong.js#L104-L114
7,891
regl-project/regl
lib/util/codegen.js
block
function block () { var code = [] function push () { code.push.apply(code, slice(arguments)) } var vars = [] function def () { var name = 'v' + (varCounter++) vars.push(name) if (arguments.length > 0) { code.push(name, '=') code.push.apply(code, slice(argume...
javascript
function block () { var code = [] function push () { code.push.apply(code, slice(arguments)) } var vars = [] function def () { var name = 'v' + (varCounter++) vars.push(name) if (arguments.length > 0) { code.push(name, '=') code.push.apply(code, slice(argume...
[ "function", "block", "(", ")", "{", "var", "code", "=", "[", "]", "function", "push", "(", ")", "{", "code", ".", "push", ".", "apply", "(", "code", ",", "slice", "(", "arguments", ")", ")", "}", "var", "vars", "=", "[", "]", "function", "def", ...
create a code block
[ "create", "a", "code", "block" ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/lib/util/codegen.js#L34-L63
7,892
regl-project/regl
lib/core.js
sortState
function sortState (state) { return state.sort(function (a, b) { if (a === S_VIEWPORT) { return -1 } else if (b === S_VIEWPORT) { return 1 } return (a < b) ? -1 : 1 }) }
javascript
function sortState (state) { return state.sort(function (a, b) { if (a === S_VIEWPORT) { return -1 } else if (b === S_VIEWPORT) { return 1 } return (a < b) ? -1 : 1 }) }
[ "function", "sortState", "(", "state", ")", "{", "return", "state", ".", "sort", "(", "function", "(", "a", ",", "b", ")", "{", "if", "(", "a", "===", "S_VIEWPORT", ")", "{", "return", "-", "1", "}", "else", "if", "(", "b", "===", "S_VIEWPORT", "...
Make sure viewport is processed first
[ "Make", "sure", "viewport", "is", "processed", "first" ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/lib/core.js#L226-L235
7,893
firebase/angularfire
src/storage/FirebaseStorage.js
_unwrapStorageSnapshot
function _unwrapStorageSnapshot(storageSnapshot) { return { bytesTransferred: storageSnapshot.bytesTransferred, downloadURL: storageSnapshot.downloadURL, metadata: storageSnapshot.metadata, ref: storageSnapshot.ref, state: storageSnapshot.state, task: storageSnapshot.task, ...
javascript
function _unwrapStorageSnapshot(storageSnapshot) { return { bytesTransferred: storageSnapshot.bytesTransferred, downloadURL: storageSnapshot.downloadURL, metadata: storageSnapshot.metadata, ref: storageSnapshot.ref, state: storageSnapshot.state, task: storageSnapshot.task, ...
[ "function", "_unwrapStorageSnapshot", "(", "storageSnapshot", ")", "{", "return", "{", "bytesTransferred", ":", "storageSnapshot", ".", "bytesTransferred", ",", "downloadURL", ":", "storageSnapshot", ".", "downloadURL", ",", "metadata", ":", "storageSnapshot", ".", "m...
Take a Storage snapshot and unwrap only the needed properties. @param snapshot @returns An object containing the unwrapped values.
[ "Take", "a", "Storage", "snapshot", "and", "unwrap", "only", "the", "needed", "properties", "." ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/storage/FirebaseStorage.js#L52-L62
7,894
firebase/angularfire
src/database/FirebaseObject.js
FirebaseObject
function FirebaseObject(ref) { if( !(this instanceof FirebaseObject) ) { return new FirebaseObject(ref); } var self = this; // These are private config props and functions used internally // they are collected here to reduce clutter in console.log and forEach th...
javascript
function FirebaseObject(ref) { if( !(this instanceof FirebaseObject) ) { return new FirebaseObject(ref); } var self = this; // These are private config props and functions used internally // they are collected here to reduce clutter in console.log and forEach th...
[ "function", "FirebaseObject", "(", "ref", ")", "{", "if", "(", "!", "(", "this", "instanceof", "FirebaseObject", ")", ")", "{", "return", "new", "FirebaseObject", "(", "ref", ")", ";", "}", "var", "self", "=", "this", ";", "// These are private config props ...
Creates a synchronized object with 2-way bindings between Angular and Firebase. @param {Firebase} ref @returns {FirebaseObject} @constructor
[ "Creates", "a", "synchronized", "object", "with", "2", "-", "way", "bindings", "between", "Angular", "and", "Firebase", "." ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseObject.js#L35-L75
7,895
firebase/angularfire
src/database/FirebaseObject.js
function () { var self = this; var ref = self.$ref(); var def = $q.defer(); var dataJSON; try { dataJSON = $firebaseUtils.toJSON(self); } catch (e) { def.reject(e); } if (typeof dataJSON !== 'undefined') { ...
javascript
function () { var self = this; var ref = self.$ref(); var def = $q.defer(); var dataJSON; try { dataJSON = $firebaseUtils.toJSON(self); } catch (e) { def.reject(e); } if (typeof dataJSON !== 'undefined') { ...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "var", "ref", "=", "self", ".", "$ref", "(", ")", ";", "var", "def", "=", "$q", ".", "defer", "(", ")", ";", "var", "dataJSON", ";", "try", "{", "dataJSON", "=", "$firebaseUtils", ".", ...
Saves all data on the FirebaseObject back to Firebase. @returns a promise which will resolve after the save is completed.
[ "Saves", "all", "data", "on", "the", "FirebaseObject", "back", "to", "Firebase", "." ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseObject.js#L82-L102
7,896
firebase/angularfire
src/database/FirebaseObject.js
function() { var self = this; $firebaseUtils.trimKeys(self, {}); self.$value = null; return $firebaseUtils.doRemove(self.$ref()).then(function() { self.$$notify(); return self.$ref(); }); }
javascript
function() { var self = this; $firebaseUtils.trimKeys(self, {}); self.$value = null; return $firebaseUtils.doRemove(self.$ref()).then(function() { self.$$notify(); return self.$ref(); }); }
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "$firebaseUtils", ".", "trimKeys", "(", "self", ",", "{", "}", ")", ";", "self", ".", "$value", "=", "null", ";", "return", "$firebaseUtils", ".", "doRemove", "(", "self", ".", "$ref", "(", ...
Removes all keys from the FirebaseObject and also removes the remote data from the server. @returns a promise which will resolve after the op completes
[ "Removes", "all", "keys", "from", "the", "FirebaseObject", "and", "also", "removes", "the", "remote", "data", "from", "the", "server", "." ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseObject.js#L110-L118
7,897
firebase/angularfire
src/database/FirebaseObject.js
function (scope, varName) { var self = this; return self.$loaded().then(function () { return self.$$conf.binding.bindTo(scope, varName); }); }
javascript
function (scope, varName) { var self = this; return self.$loaded().then(function () { return self.$$conf.binding.bindTo(scope, varName); }); }
[ "function", "(", "scope", ",", "varName", ")", "{", "var", "self", "=", "this", ";", "return", "self", ".", "$loaded", "(", ")", ".", "then", "(", "function", "(", ")", "{", "return", "self", ".", "$$conf", ".", "binding", ".", "bindTo", "(", "scop...
Creates a 3-way data sync between this object, the Firebase server, and a scope variable. This means that any changes made to the scope variable are pushed to Firebase, and vice versa. If scope emits a $destroy event, the binding is automatically severed. Otherwise, it is possible to unbind the scope variable by using...
[ "Creates", "a", "3", "-", "way", "data", "sync", "between", "this", "object", "the", "Firebase", "server", "and", "a", "scope", "variable", ".", "This", "means", "that", "any", "changes", "made", "to", "the", "scope", "variable", "are", "pushed", "to", "...
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseObject.js#L165-L170
7,898
firebase/angularfire
src/auth/FirebaseAuth.js
function (stringOrProvider) { var provider; if (typeof stringOrProvider == "string") { var providerID = stringOrProvider.slice(0, 1).toUpperCase() + stringOrProvider.slice(1); provider = new firebase.auth[providerID+"AuthProvider"](); } else { provider = stringOrProvider; ...
javascript
function (stringOrProvider) { var provider; if (typeof stringOrProvider == "string") { var providerID = stringOrProvider.slice(0, 1).toUpperCase() + stringOrProvider.slice(1); provider = new firebase.auth[providerID+"AuthProvider"](); } else { provider = stringOrProvider; ...
[ "function", "(", "stringOrProvider", ")", "{", "var", "provider", ";", "if", "(", "typeof", "stringOrProvider", "==", "\"string\"", ")", "{", "var", "providerID", "=", "stringOrProvider", ".", "slice", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", ")",...
Helper method to turn provider names into AuthProvider instances @param {object} stringOrProvider Provider ID string to AuthProvider instance @return {firebdase.auth.AuthProvider} A valid AuthProvider instance
[ "Helper", "method", "to", "turn", "provider", "names", "into", "AuthProvider", "instances" ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/auth/FirebaseAuth.js#L221-L230
7,899
firebase/angularfire
src/auth/FirebaseAuth.js
function() { var auth = this._auth; return this._q(function(resolve) { var off; function callback() { // Turn off this onAuthStateChanged() callback since we just needed to get the authentication data once. off(); resolve(); } off = auth.onAuthS...
javascript
function() { var auth = this._auth; return this._q(function(resolve) { var off; function callback() { // Turn off this onAuthStateChanged() callback since we just needed to get the authentication data once. off(); resolve(); } off = auth.onAuthS...
[ "function", "(", ")", "{", "var", "auth", "=", "this", ".", "_auth", ";", "return", "this", ".", "_q", "(", "function", "(", "resolve", ")", "{", "var", "off", ";", "function", "callback", "(", ")", "{", "// Turn off this onAuthStateChanged() callback since ...
Helper that returns a promise which resolves when the initial auth state has been fetched from the Firebase server. This never rejects and resolves to undefined. @return {Promise<Object>} A promise fulfilled when the server returns initial auth state.
[ "Helper", "that", "returns", "a", "promise", "which", "resolves", "when", "the", "initial", "auth", "state", "has", "been", "fetched", "from", "the", "Firebase", "server", ".", "This", "never", "rejects", "and", "resolves", "to", "undefined", "." ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/auth/FirebaseAuth.js#L238-L250