_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q25800
train
function( element ) { var i; element = $.getElement( element ); i = getOverlayIndex( this.currentOverlays, element ); if ( i >= 0 ) { this.currentOverlays[ i ].destroy(); this.currentOverlays.splice( i, 1 ); THIS[ this.hash ].forceRedraw = true; ...
javascript
{ "resource": "" }
q25801
train
function() { while ( this.currentOverlays.length > 0 ) { this.currentOverlays.pop().destroy(); } THIS[ this.hash ].forceRedraw = true; /** * Raised when all overlays are removed from the viewer (see {@link OpenSeadragon.Drawer#clearOverlays}). * * @...
javascript
{ "resource": "" }
q25802
train
function( element ) { var i; element = $.getElement( element ); i = getOverlayIndex( this.currentOverlays, element ); if (i >= 0) { return this.currentOverlays[i]; } else { return null; } }
javascript
{ "resource": "" }
q25803
train
function( page ) { if ( this.nextButton ) { if(!this.tileSources || this.tileSources.length - 1 === page) { //Disable next button if ( !this.navPrevNextWrap ) { this.nextButton.disable(); } }...
javascript
{ "resource": "" }
q25804
train
function ( message ) { this._hideMessage(); var div = $.makeNeutralElement( "div" ); div.appendChild( document.createTextNode( message ) ); this.messageDiv = $.makeCenteredNode( div ); $.addClass(this.messageDiv, "openseadragon-message"); this.container.appendChild( t...
javascript
{ "resource": "" }
q25805
train
function() { this.showReferenceStrip = true; if (this.sequenceMode) { if (this.referenceStrip) { return; } if (this.tileSources.length && this.tileSources.length > 1) { this.referenceStrip = new $.ReferenceStrip({ ...
javascript
{ "resource": "" }
q25806
beginControlsAutoHide
train
function beginControlsAutoHide( viewer ) { if ( !viewer.autoHideControls ) { return; } viewer.controlsShouldFade = true; viewer.controlsFadeBeginTime = $.now() + viewer.controlsFadeDelay; window.setTimeout( function(){ scheduleControlsFade( viewer ); }, viewer.co...
javascript
{ "resource": "" }
q25807
updateControlsFade
train
function updateControlsFade( viewer ) { var currentTime, deltaTime, opacity, i; if ( viewer.controlsShouldFade ) { currentTime = $.now(); deltaTime = currentTime - viewer.controlsFadeBeginTime; opacity = 1.0 - deltaTime / viewer.controlsFadeLength; opacit...
javascript
{ "resource": "" }
q25808
abortControlsAutoHide
train
function abortControlsAutoHide( viewer ) { var i; viewer.controlsShouldFade = false; for ( i = viewer.controls.length - 1; i >= 0; i-- ) { viewer.controls[ i ].setOpacity( 1.0 ); } }
javascript
{ "resource": "" }
q25809
train
function () { var i; stopTracking( this ); this.element = null; for ( i = 0; i < MOUSETRACKERS.length; i++ ) { if ( MOUSETRACKERS[ i ] === this ) { MOUSETRACKERS.splice( i, 1 ); break; } ...
javascript
{ "resource": "" }
q25810
train
function () { var delegate = THIS[ this.hash ], i, len = delegate.activePointersLists.length, count = 0; for ( i = 0; i < len; i++ ) { count += delegate.activePointersLists[ i ].getLength(); } return count;...
javascript
{ "resource": "" }
q25811
train
function ( tracker, gPoint ) { return tracker.hash.toString() + gPoint.type + gPoint.id.toString(); }
javascript
{ "resource": "" }
q25812
train
function () { var i, len = trackerPoints.length, trackPoint, gPoint, now = $.now(), elapsedTime, distance, speed; elapsedTime = now - lastTime; lastTime = now; ...
javascript
{ "resource": "" }
q25813
train
function ( tracker, gPoint ) { var guid = _generateGuid( tracker, gPoint ); trackerPoints.push( { guid: guid, gPoint: gPoint, lastPos: gPoint.currentPos } ); // Only fire up the interval tim...
javascript
{ "resource": "" }
q25814
train
function ( tracker, gPoint ) { var guid = _generateGuid( tracker, gPoint ), i, len = trackerPoints.length; for ( i = 0; i < len; i++ ) { if ( trackerPoints[ i ].guid === guid ) { trackerPoints.splice( i, 1 ); ...
javascript
{ "resource": "" }
q25815
startTracking
train
function startTracking( tracker ) { var delegate = THIS[ tracker.hash ], event, i; if ( !delegate.tracking ) { for ( i = 0; i < $.MouseTracker.subscribeEvents.length; i++ ) { event = $.MouseTracker.subscribeEvents[ i ]; $.addEvent( ...
javascript
{ "resource": "" }
q25816
stopTracking
train
function stopTracking( tracker ) { var delegate = THIS[ tracker.hash ], event, i; if ( delegate.tracking ) { for ( i = 0; i < $.MouseTracker.subscribeEvents.length; i++ ) { event = $.MouseTracker.subscribeEvents[ i ]; $.removeEvent( ...
javascript
{ "resource": "" }
q25817
capturePointer
train
function capturePointer( tracker, pointerType, pointerCount ) { var pointsList = tracker.getActivePointersListByType( pointerType ), eventParams; pointsList.captureCount += (pointerCount || 1); if ( pointsList.captureCount === 1 ) { if ( $.Browser.vendor === $.BROWSERS....
javascript
{ "resource": "" }
q25818
onMouseWheel
train
function onMouseWheel( tracker, event ) { event = $.getEvent( event ); // Simulate a 'wheel' event var simulatedEvent = { target: event.target || event.srcElement, type: "wheel", shiftKey: event.shiftKey || false, clientX: event.cli...
javascript
{ "resource": "" }
q25819
train
function( container ) { if (!this.cacheImageRecord) { $.console.warn( '[Tile.drawHTML] attempting to draw tile %s when it\'s not cached', this.toString()); return; } if ( !this.loaded ) { $.console.warn( "Attemp...
javascript
{ "resource": "" }
q25820
train
function( context, drawingHandler, scale, translate ) { var position = this.position.times($.pixelDensityRatio), size = this.size.times($.pixelDensityRatio), rendered; if (!this.context2D && !this.cacheImageRecord) { $.console.warn( '[Tile.drawCa...
javascript
{ "resource": "" }
q25821
train
function() { var context; if (this.cacheImageRecord) { context = this.cacheImageRecord.getRenderedContext(); } else if (this.context2D) { context = this.context2D; } else { $.console.warn( '[Tile.drawCanvas] attempting to get tile scale...
javascript
{ "resource": "" }
q25822
train
function(scale, canvasSize, sketchCanvasSize) { // The translation vector must have positive values, otherwise the image goes a bit off // the sketch canvas to the top and left and we must use negative coordinates to repaint it // to the main canvas. In that case, some browsers throw: //...
javascript
{ "resource": "" }
q25823
train
function() { if ( this.imgElement && this.imgElement.parentNode ) { this.imgElement.parentNode.removeChild( this.imgElement ); } if ( this.element && this.element.parentNode ) { this.element.parentNode.removeChild( this.element ); } this.element = null...
javascript
{ "resource": "" }
q25824
train
function( item, options ) { $.console.assert(item, "[World.addItem] item is required"); $.console.assert(item instanceof $.TiledImage, "[World.addItem] only TiledImages supported at this time"); options = options || {}; if (options.index !== undefined) { var index = Math.max...
javascript
{ "resource": "" }
q25825
train
function( item, index ) { $.console.assert(item, "[World.setItemIndex] item is required"); $.console.assert(index !== undefined, "[World.setItemIndex] index is required"); var oldIndex = this.getIndexOfItem( item ); if ( index >= this._items.length ) { throw new Error( "Ind...
javascript
{ "resource": "" }
q25826
train
function() { // We need to make sure any pending images are canceled so the world items don't get messed up this.viewer._cancelPendingImages(); var item; var i; for (i = 0; i < this._items.length; i++) { item = this._items[i]; item.removeHandler('bounds-ch...
javascript
{ "resource": "" }
q25827
train
function() { for ( var i = 0; i < this._items.length; i++ ) { this._items[i].draw(); } this._needsDraw = false; }
javascript
{ "resource": "" }
q25828
train
function(options) { options = options || {}; var immediately = options.immediately || false; var layout = options.layout || $.DEFAULT_SETTINGS.collectionLayout; var rows = options.rows || $.DEFAULT_SETTINGS.collectionRows; var columns = options.columns || $.DEFAULT_SETTINGS.colle...
javascript
{ "resource": "" }
q25829
train
function(position, size) { var properties = $.Placement.properties[this.placement]; if (!properties) { return; } if (properties.isHorizontallyCentered) { position.x -= size.x / 2; } else if (properties.isRight) { ...
javascript
{ "resource": "" }
q25830
train
function(location, placement) { var options = $.isPlainObject(location) ? location : { location: location, placement: placement }; this._init({ location: options.location || this.location, placement: options.placement !=...
javascript
{ "resource": "" }
q25831
train
function(viewport) { $.console.assert(viewport, 'A viewport must now be passed to Overlay.getBounds.'); var width = this.width; var height = this.height; if (width === null || height === null) { var size = viewport.deltaPointsFromPixelsNoRo...
javascript
{ "resource": "" }
q25832
train
function() { if (this.miniViewers) { for (var key in this.miniViewers) { this.miniViewers[key].destroy(); } } if (this.element) { this.element.parentNode.removeChild(this.element); } }
javascript
{ "resource": "" }
q25833
train
function(contentSize) { $.console.assert(contentSize, "[Viewport.resetContentSize] contentSize is required"); $.console.assert(contentSize instanceof $.Point, "[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"); $.console.assert(contentSize.x > 0, "[Viewport.resetContentSiz...
javascript
{ "resource": "" }
q25834
train
function(bounds, contentFactor) { $.console.assert(bounds, "[Viewport._setContentBounds] bounds is required"); $.console.assert(bounds instanceof $.Rect, "[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"); $.console.assert(bounds.width > 0, "[Viewport._setContentBounds] bounds....
javascript
{ "resource": "" }
q25835
train
function() { if (this.defaultZoomLevel) { return this.defaultZoomLevel; } var aspectFactor = this._contentAspectRatio / this.getAspectRatio(); var output; if (this.homeFillsViewer) { // fill the viewer and clip the image output = aspectFactor >= 1 ? aspec...
javascript
{ "resource": "" }
q25836
train
function(margins) { $.console.assert($.type(margins) === 'object', '[Viewport.setMargins] margins must be an object'); this._margins = $.extend({ left: 0, top: 0, right: 0, bottom: 0 }, margins); this._updateContainerInnerSize(); ...
javascript
{ "resource": "" }
q25837
train
function(immediately) { var actualZoom = this.getZoom(); var constrainedZoom = this._applyZoomConstraints(actualZoom); if (actualZoom !== constrainedZoom) { this.zoomTo(constrainedZoom, this.zoomPoint, immediately); } var bounds = this.getBoundsNoRotate(); v...
javascript
{ "resource": "" }
q25838
train
function(immediately) { var box = new $.Rect( this._contentBounds.x, this._contentBounds.y + (this._contentBounds.height / 2), this._contentBounds.width, 0); return this.fitBounds(box, immediately); }
javascript
{ "resource": "" }
q25839
train
function(current) { var bounds, constrainedBounds; bounds = this.getBounds(current); constrainedBounds = this._applyBoundaryConstraints(bounds); return constrainedBounds; }
javascript
{ "resource": "" }
q25840
train
function(zoom, refPoint, immediately) { var _this = this; this.zoomPoint = refPoint instanceof $.Point && !isNaN(refPoint.x) && !isNaN(refPoint.y) ? refPoint : null; if (immediately) { this._adjustCenterSpringsForZoomPoint(function() ...
javascript
{ "resource": "" }
q25841
train
function(degrees) { if (!this.viewer || !this.viewer.drawer.canRotate()) { return this; } this.degrees = $.positiveModulo(degrees, 360); this._setContentBounds( this.viewer.world.getHomeBounds(), this.viewer.world.getContentFactor()); this.view...
javascript
{ "resource": "" }
q25842
train
function(pixel, current) { var bounds = this.getBoundsNoRotate(current); return pixel.minus( new $.Point(this._margins.left, this._margins.top) ).divide( this._containerInnerSize.x / bounds.width ).plus( bounds.getTopLeft() ); }
javascript
{ "resource": "" }
q25843
train
function(rectangle) { return $.Rect.fromSummits( this.pointFromPixel(rectangle.getTopLeft(), true), this.pointFromPixel(rectangle.getTopRight(), true), this.pointFromPixel(rectangle.getBottomLeft(), true) ); }
javascript
{ "resource": "" }
q25844
train
function(rectangle) { return $.Rect.fromSummits( this.pixelFromPoint(rectangle.getTopLeft(), true), this.pixelFromPoint(rectangle.getTopRight(), true), this.pixelFromPoint(rectangle.getBottomLeft(), true) ); }
javascript
{ "resource": "" }
q25845
train
function(point) { $.console.assert(this.viewer, "[Viewport.viewportToWindowCoordinates] the viewport must have a viewer."); var viewerCoordinates = this.viewportToViewerElementCoordinates(point); return viewerCoordinates.plus( $.getElementPosition(this.viewer.element)...
javascript
{ "resource": "" }
q25846
train
function( state ) { if ( this.flipped === state ) { return this; } this.flipped = state; if(this.viewer.navigator){ this.viewer.navigator.setFlip(this.getFlip()); } this.viewer.forceRedraw(); /** * Raised when flip state has been changed. * ...
javascript
{ "resource": "" }
q25847
train
function (level, x, y) { var url = null; if (level >= this.minLevel && level <= this.maxLevel) { url = this.levels[level].url; } return url; }
javascript
{ "resource": "" }
q25848
train
function (level, x, y) { var context = null; if (level >= this.minLevel && level <= this.maxLevel) { context = this.levels[level].context2D; } return context; }
javascript
{ "resource": "" }
q25849
train
function(){ var self = this; var selfAbort = this.abort; this.image = new Image(); this.image.onload = function(){ self.finish(true); }; this.image.onabort = this.image.onerror = function() { self.errorMsg = "Image load aborted"; self...
javascript
{ "resource": "" }
q25850
train
function(options) { var _this = this, complete = function(job) { completeJob(_this, job, options.callback); }, jobOptions = { src: options.src, loadWithAjax: options.loadWithAjax, ajaxHeaders: options.loadWithAja...
javascript
{ "resource": "" }
q25851
train
function() { for( var i = 0; i < this.jobQueue.length; i++ ) { var job = this.jobQueue[i]; if ( typeof job.abort === "function" ) { job.abort(); } } this.jobQueue = []; }
javascript
{ "resource": "" }
q25852
completeJob
train
function completeJob(loader, job, callback) { var nextJob; loader.jobsInProgress--; if ((!loader.jobLimit || loader.jobsInProgress < loader.jobLimit) && loader.jobQueue.length > 0) { nextJob = loader.jobQueue.shift(); nextJob.start(); loader.jobsInProgress++; } callback(jo...
javascript
{ "resource": "" }
q25853
train
function( level ) { if(this.emulateLegacyImagePyramid) { return $.TileSource.prototype.getTileWidth.call(this, level); } var scaleFactor = Math.pow(2, this.maxLevel - level); if (this.tileSizePerScaleFactor && this.tileSizePerScaleFactor[scaleFactor]) { return ...
javascript
{ "resource": "" }
q25854
train
function( level ) { if(this.emulateLegacyImagePyramid) { return $.TileSource.prototype.getTileHeight.call(this, level); } var scaleFactor = Math.pow(2, this.maxLevel - level); if (this.tileSizePerScaleFactor && this.tileSizePerScaleFactor[scaleFactor]) { return...
javascript
{ "resource": "" }
q25855
train
function( level, x, y ){ if(this.emulateLegacyImagePyramid) { var url = null; if ( this.levels.length > 0 && level >= this.minLevel && level <= this.maxLevel ) { url = this.levels[ level ].url; } return url; } //# constants ...
javascript
{ "resource": "" }
q25856
canBeTiled
train
function canBeTiled ( profile ) { var level0Profiles = [ "http://library.stanford.edu/iiif/image-api/compliance.html#level0", "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0", "http://iiif.io/api/image/2/level0.json" ]; var isLevel0 = (l...
javascript
{ "resource": "" }
q25857
train
function ( eventName, handler, userData ) { var events = this.events[ eventName ]; if ( !events ) { this.events[ eventName ] = events = []; } if ( handler && $.isFunction( handler ) ) { events[ events.length ] = { handler: handler, userData: userData || null }; ...
javascript
{ "resource": "" }
q25858
train
function ( eventName, handler ) { var events = this.events[ eventName ], handlers = [], i; if ( !events ) { return; } if ( $.isArray( events ) ) { for ( i = 0; i < events.length; i++ ) { if ( events[i].handler !== handler ) ...
javascript
{ "resource": "" }
q25859
train
function ( eventName ) { var events = this.events[ eventName ]; if ( !events || !events.length ) { return null; } events = events.length === 1 ? [ events[ 0 ] ] : Array.apply( null, events ); return function ( source, args ) { var i...
javascript
{ "resource": "" }
q25860
train
function( eventName, eventArgs ) { //uncomment if you want to get a log of all events //$.console.log( eventName ); var handler = this.getHandler( eventName ); if ( handler ) { if ( !eventArgs ) { eventArgs = {}; } handler( this, even...
javascript
{ "resource": "" }
q25861
createDocgen
train
async function createDocgen() { const customPropTypes = await getCustomPropTypes(); const components = await getDocumentableComponents(); const propTypesDatabase = getPropTypeLinks(components); const docgens = await Promise.all(components.map(c => createComponentsDocgen(c, customPropTypes))); const database ...
javascript
{ "resource": "" }
q25862
findLink
train
function findLink(ref) { if (lastLink.indexOf(ref) !== -1) { return lastLink; } lastLink = ''; routes.some((link) => { if (link.indexOf(ref) !== -1) { lastLink = link; } return lastLink; }); return lastLink; }
javascript
{ "resource": "" }
q25863
githubProxy
train
async function githubProxy(req, res) { const response = await fetchGithub(req.url, { headers }); setHeader(RATE_LIMIT, res, response); setHeader(RATE_REMAINING, res, response); setHeader(RATE_RESET, res, response); if (response.ok) { const json = await response.json(); res.json(json); } else if (res...
javascript
{ "resource": "" }
q25864
headerQuickLinkReplacer
train
function headerQuickLinkReplacer(fullMatch, openingTag, headerId, remainingHtml, headerText) { const link = makeLink(headerId, headerText); return `${openingTag} class="quick-link quick-link__container">${link}${remainingHtml}`; }
javascript
{ "resource": "" }
q25865
requiredByAllControls
train
function requiredByAllControls(validator) { return function validate(props, propName, component, ...others) { let err = validator(props, propName, component, ...others); if (!err && typeof props[propName] === 'undefined') { const invalids = props.controls.filter(c => !c[propName]).map((_, i) => i); ...
javascript
{ "resource": "" }
q25866
getBuildProperty
train
function getBuildProperty(project, property) { const firstTarget = project.getFirstTarget().firstTarget; const configurationList = project.pbxXCConfigurationList()[ firstTarget.buildConfigurationList ]; const defaultBuildConfiguration = configurationList.buildConfigurations.reduce( (acc,...
javascript
{ "resource": "" }
q25867
getTargetAttributes
train
function getTargetAttributes(project, target) { var attributes = project.getFirstProject()['firstProject']['attributes']; target = target || project.getFirstTarget(); if (attributes['TargetAttributes'] === undefined) { attributes['TargetAttributes'] = {}; } if (attributes['TargetAttributes...
javascript
{ "resource": "" }
q25868
dup
train
function dup( text, count ) { let result = ""; for ( let i = 1; i <= count; i++ ) result += text; return result; }
javascript
{ "resource": "" }
q25869
reportUndefinedRules
train
function reportUndefinedRules( ast, session, options ) { const check = session.buildVisitor( { rule_ref( node ) { if ( ! ast.findRule( node.name ) ) { session.error( `Rule "${ node.name }" is not defined.`, node.location ...
javascript
{ "resource": "" }
q25870
calcReportFailures
train
function calcReportFailures( ast, session, options ) { // By default, not report failures for rules... ast.rules.forEach( rule => { rule.reportFailures = false; } ); // ...but report for start rules, because in that context report failures // always enabled const changedRules = optio...
javascript
{ "resource": "" }
q25871
reportDuplicateLabels
train
function reportDuplicateLabels( ast, session ) { let check; function checkExpressionWithClonedEnv( node, env ) { check( node.expression, util.clone( env ) ); } check = session.buildVisitor( { rule( node ) { check( node.expression, {} ); }, choice( node...
javascript
{ "resource": "" }
q25872
evalModule
train
function evalModule( source, context ) { const argumentKeys = Object.keys( context ); const argumentValues = argumentKeys.map( argument => context[ argument ] ); const sandbox = { exports: {} }; argumentKeys.push( "module", "exports", source ); argumentValues.push( sandbox, sandbox.exports ); ...
javascript
{ "resource": "" }
q25873
createNode
train
function createNode( type, details ) { const node = new ast.Node( type, location() ); if ( details === null ) return node; util.extend( node, details ); return util.enforceFastProperties( node ); }
javascript
{ "resource": "" }
q25874
addComment
train
function addComment( text, multiline ) { if ( options.extractComments ) { const loc = location(); comments[ loc.start.offset ] = { text: text, multiline: multiline, location: loc, }; } retu...
javascript
{ "resource": "" }
q25875
reportDuplicateRules
train
function reportDuplicateRules( ast, session ) { const rules = {}; const check = session.buildVisitor( { rule( node ) { const name = node.name; if ( __hasOwnProperty.call( rules, name ) ) { const start = rules[ name ].start; session.error( ...
javascript
{ "resource": "" }
q25876
reportUnusedRules
train
function reportUnusedRules( ast, session, options ) { const used = {}; function yes( node ) { used[ node.name || node ] = true; } options.allowedStartRules.forEach( yes ); session.buildVisitor( { rule_ref: yes } )( ast ); ast.rules.forEach( rule => { if ( used[ rule.name ] ...
javascript
{ "resource": "" }
q25877
W3CWebSocket
train
function W3CWebSocket(uri, protocols) { var native_instance; if (protocols) { native_instance = new NativeWebSocket(uri, protocols); } else { native_instance = new NativeWebSocket(uri); } /** * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket * class). Since it is an Object i...
javascript
{ "resource": "" }
q25878
WebSocketFrame
train
function WebSocketFrame(maskBytes, frameHeader, config) { this.maskBytes = maskBytes; this.frameHeader = frameHeader; this.config = config; this.maxReceivedFrameSize = config.maxReceivedFrameSize; this.protocolError = false; this.frameTooLarge = false; this.invalidCloseFrameLength = false; ...
javascript
{ "resource": "" }
q25879
train
function() { var EPS = 0.000001; this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) ); return this; }
javascript
{ "resource": "" }
q25880
extractFromCache
train
function extractFromCache ( cache ) { var values = []; for ( var key in cache ) { var data = cache[ key ]; delete data.metadata; values.push( data ); } return values; }
javascript
{ "resource": "" }
q25881
train
function() { var actions = this._actions, nActions = this._nActiveActions, bindings = this._bindings, nBindings = this._nActiveBindings; this._nActiveActions = 0; this._nActiveBindings = 0; for ( var i = 0; i !== nActions; ++ i ) { actions[ i ].reset(); } for ( var i = 0; i !== nBindings; ...
javascript
{ "resource": "" }
q25882
train
function( clip ) { var actions = this._actions, clipUuid = clip.uuid, actionsByClip = this._actionsByClip, actionsForClip = actionsByClip[ clipUuid ]; if ( actionsForClip !== undefined ) { // note: just calling _removeInactiveAction would mess up the // iteration state and also require updating th...
javascript
{ "resource": "" }
q25883
train
function( root ) { var rootUuid = root.uuid, actionsByClip = this._actionsByClip; for ( var clipUuid in actionsByClip ) { var actionByRoot = actionsByClip[ clipUuid ].actionByRoot, action = actionByRoot[ rootUuid ]; if ( action !== undefined ) { this._deactivateAction( action ); this._remo...
javascript
{ "resource": "" }
q25884
train
function( clip, optionalRoot ) { var action = this.existingAction( clip, optionalRoot ); if ( action !== null ) { this._deactivateAction( action ); this._removeInactiveAction( action ); } }
javascript
{ "resource": "" }
q25885
train
function( binding, rootUuid, trackName ) { var bindingsByRoot = this._bindingsByRootAndName, bindingByName = bindingsByRoot[ rootUuid ], bindings = this._bindings; if ( bindingByName === undefined ) { bindingByName = {}; bindingsByRoot[ rootUuid ] = bindingByName; } bindingByName[ trackName ] ...
javascript
{ "resource": "" }
q25886
train
function() { var interpolants = this._controlInterpolants, lastActiveIndex = this._nActiveControlInterpolants ++, interpolant = interpolants[ lastActiveIndex ]; if ( interpolant === undefined ) { interpolant = new THREE.LinearInterpolant( new Float32Array( 2 ), new Float32Array( 2 ), 1, this....
javascript
{ "resource": "" }
q25887
train
function( var_args ) { var objects = this._objects, nObjects = objects.length, nCachedObjects = this.nCachedObjects_, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length; for ( var i = 0, n = arguments.length; i !== n; ++ i ) { var object = arguments[ i ]...
javascript
{ "resource": "" }
q25888
train
function( array, type, forceClone ) { if ( ! array || // let 'undefined' and 'null' pass ! forceClone && array.constructor === type ) return array; if ( typeof type.BYTES_PER_ELEMENT === 'number' ) { return new type( array ); // create typed array } return Array.prototype.slice.call( array ); // cre...
javascript
{ "resource": "" }
q25889
train
function( times ) { function compareTime( i, j ) { return times[ i ] - times[ j ]; } var n = times.length; var result = new Array( n ); for ( var i = 0; i !== n; ++ i ) result[ i ] = i; result.sort( compareTime ); return result; }
javascript
{ "resource": "" }
q25890
train
function( values, stride, order ) { var nValues = values.length; var result = new values.constructor( nValues ); for ( var i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) { var srcOffset = order[ i ] * stride; for ( var j = 0; j !== stride; ++ j ) { result[ dstOffset ++ ] = values[ srcOffset + ...
javascript
{ "resource": "" }
q25891
train
function( jsonKeys, times, values, valuePropertyName ) { var i = 1, key = jsonKeys[ 0 ]; while ( key !== undefined && key[ valuePropertyName ] === undefined ) { key = jsonKeys[ i ++ ]; } if ( key === undefined ) return; // no data var value = key[ valuePropertyName ]; if ( value === undefined ) ret...
javascript
{ "resource": "" }
q25892
train
function( timeOffset ) { if( timeOffset !== 0.0 ) { var times = this.times; for( var i = 0, n = times.length; i !== n; ++ i ) { times[ i ] += timeOffset; } } return this; }
javascript
{ "resource": "" }
q25893
train
function() { var binding = this.binding; var buffer = this.buffer, stride = this.valueSize, originalValueOffset = stride * 3; binding.getValue( buffer, originalValueOffset ); // accu[0..1] := orig -- initially detect changes against the original for ( var i = stride, e = originalValueOffset; i !== ...
javascript
{ "resource": "" }
q25894
train
function ( focalLength ) { // see http://www.bobatkins.com/photography/technical/field_of_view.html var vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; this.fov = THREE.Math.RAD2DEG * 2 * Math.atan( vExtentSlope ); this.updateProjectionMatrix(); }
javascript
{ "resource": "" }
q25895
train
function ( t, p0, p1, p2, p3 ) { return - 3 * p0 * ( 1 - t ) * ( 1 - t ) + 3 * p1 * ( 1 - t ) * ( 1 - t ) - 6 * t * p1 * ( 1 - t ) + 6 * t * p2 * ( 1 - t ) - 3 * t * t * p2 + 3 * t * t * p3; }
javascript
{ "resource": "" }
q25896
train
function ( contour ) { var n = contour.length; var a = 0.0; for ( var p = n - 1, q = 0; q < n; p = q ++ ) { a += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y; } return a * 0.5; }
javascript
{ "resource": "" }
q25897
train
function( t ) { var delta = 0.0001; var t1 = t - delta; var t2 = t + delta; // Capping in case of danger if ( t1 < 0 ) t1 = 0; if ( t2 > 1 ) t2 = 1; var pt1 = this.getPoint( t1 ); var pt2 = this.getPoint( t2 ); var vec = pt2.clone().sub( pt1 ); return vec.normalize(); }
javascript
{ "resource": "" }
q25898
calculatePositionOnCurve
train
function calculatePositionOnCurve( u, p, q, radius, position ) { var cu = Math.cos( u ); var su = Math.sin( u ); var quOverP = q / p * u; var cs = Math.cos( quOverP ); position.x = radius * ( 2 + cs ) * 0.5 * cu; position.y = radius * ( 2 + cs ) * su * 0.5; position.z = radius * Math.sin( quOverP ) * 0....
javascript
{ "resource": "" }
q25899
subdivide
train
function subdivide( face, detail ) { var cols = Math.pow( 2, detail ); var a = prepare( that.vertices[ face.a ] ); var b = prepare( that.vertices[ face.b ] ); var c = prepare( that.vertices[ face.c ] ); var v = []; // Construct all of the vertices for this subdivision. for ( var i = 0 ; i <= cols; i ++...
javascript
{ "resource": "" }