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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
openseadragon/openseadragon | src/viewer.js | 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 | 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;
... | [
"function",
"(",
"element",
")",
"{",
"var",
"i",
";",
"element",
"=",
"$",
".",
"getElement",
"(",
"element",
")",
";",
"i",
"=",
"getOverlayIndex",
"(",
"this",
".",
"currentOverlays",
",",
"element",
")",
";",
"if",
"(",
"i",
">=",
"0",
")",
"{"... | Removes an overlay identified by the reference element or element id
and schedules an update.
@method
@param {Element|String} element - A reference to the element or an
element id which represent the ovelay content to be removed.
@return {OpenSeadragon.Viewer} Chainable.
@fires OpenSeadragon.Viewer.event:remove-overlay | [
"Removes",
"an",
"overlay",
"identified",
"by",
"the",
"reference",
"element",
"or",
"element",
"id",
"and",
"schedules",
"an",
"update",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewer.js#L2022-L2049 | train | |
openseadragon/openseadragon | src/viewer.js | 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 | 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}).
*
* @... | [
"function",
"(",
")",
"{",
"while",
"(",
"this",
".",
"currentOverlays",
".",
"length",
">",
"0",
")",
"{",
"this",
".",
"currentOverlays",
".",
"pop",
"(",
")",
".",
"destroy",
"(",
")",
";",
"}",
"THIS",
"[",
"this",
".",
"hash",
"]",
".",
"for... | Removes all currently configured Overlays from this Viewer and schedules
an update.
@method
@return {OpenSeadragon.Viewer} Chainable.
@fires OpenSeadragon.Viewer.event:clear-overlay | [
"Removes",
"all",
"currently",
"configured",
"Overlays",
"from",
"this",
"Viewer",
"and",
"schedules",
"an",
"update",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewer.js#L2058-L2074 | train | |
openseadragon/openseadragon | src/viewer.js | function( element ) {
var i;
element = $.getElement( element );
i = getOverlayIndex( this.currentOverlays, element );
if (i >= 0) {
return this.currentOverlays[i];
} else {
return null;
}
} | javascript | function( element ) {
var i;
element = $.getElement( element );
i = getOverlayIndex( this.currentOverlays, element );
if (i >= 0) {
return this.currentOverlays[i];
} else {
return null;
}
} | [
"function",
"(",
"element",
")",
"{",
"var",
"i",
";",
"element",
"=",
"$",
".",
"getElement",
"(",
"element",
")",
";",
"i",
"=",
"getOverlayIndex",
"(",
"this",
".",
"currentOverlays",
",",
"element",
")",
";",
"if",
"(",
"i",
">=",
"0",
")",
"{"... | Finds an overlay identified by the reference element or element id
and returns it as an object, return null if not found.
@method
@param {Element|String} element - A reference to the element or an
element id which represents the overlay content.
@return {OpenSeadragon.Overlay} the matching overlay or null if none found... | [
"Finds",
"an",
"overlay",
"identified",
"by",
"the",
"reference",
"element",
"or",
"element",
"id",
"and",
"returns",
"it",
"as",
"an",
"object",
"return",
"null",
"if",
"not",
"found",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewer.js#L2084-L2095 | train | |
openseadragon/openseadragon | src/viewer.js | function( page ) {
if ( this.nextButton ) {
if(!this.tileSources || this.tileSources.length - 1 === page) {
//Disable next button
if ( !this.navPrevNextWrap ) {
this.nextButton.disable();
}
}... | javascript | function( page ) {
if ( this.nextButton ) {
if(!this.tileSources || this.tileSources.length - 1 === page) {
//Disable next button
if ( !this.navPrevNextWrap ) {
this.nextButton.disable();
}
}... | [
"function",
"(",
"page",
")",
"{",
"if",
"(",
"this",
".",
"nextButton",
")",
"{",
"if",
"(",
"!",
"this",
".",
"tileSources",
"||",
"this",
".",
"tileSources",
".",
"length",
"-",
"1",
"===",
"page",
")",
"{",
"//Disable next button",
"if",
"(",
"!"... | Updates the sequence buttons.
@function OpenSeadragon.Viewer.prototype._updateSequenceButtons
@private
@param {Number} Sequence Value | [
"Updates",
"the",
"sequence",
"buttons",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewer.js#L2103-L2125 | train | |
openseadragon/openseadragon | src/viewer.js | 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 | 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... | [
"function",
"(",
"message",
")",
"{",
"this",
".",
"_hideMessage",
"(",
")",
";",
"var",
"div",
"=",
"$",
".",
"makeNeutralElement",
"(",
"\"div\"",
")",
";",
"div",
".",
"appendChild",
"(",
"document",
".",
"createTextNode",
"(",
"message",
")",
")",
... | Display a message in the viewport
@function OpenSeadragon.Viewer.prototype._showMessage
@private
@param {String} text message | [
"Display",
"a",
"message",
"in",
"the",
"viewport"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewer.js#L2133-L2144 | train | |
openseadragon/openseadragon | src/viewer.js | function() {
this.showReferenceStrip = true;
if (this.sequenceMode) {
if (this.referenceStrip) {
return;
}
if (this.tileSources.length && this.tileSources.length > 1) {
this.referenceStrip = new $.ReferenceStrip({
... | javascript | function() {
this.showReferenceStrip = true;
if (this.sequenceMode) {
if (this.referenceStrip) {
return;
}
if (this.tileSources.length && this.tileSources.length > 1) {
this.referenceStrip = new $.ReferenceStrip({
... | [
"function",
"(",
")",
"{",
"this",
".",
"showReferenceStrip",
"=",
"true",
";",
"if",
"(",
"this",
".",
"sequenceMode",
")",
"{",
"if",
"(",
"this",
".",
"referenceStrip",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
".",
"tileSources",
".",
"len... | Enables and displays the reference strip based on the currently set tileSources.
Works only when the Viewer has sequenceMode set to true.
@function | [
"Enables",
"and",
"displays",
"the",
"reference",
"strip",
"based",
"on",
"the",
"currently",
"set",
"tileSources",
".",
"Works",
"only",
"when",
"the",
"Viewer",
"has",
"sequenceMode",
"set",
"to",
"true",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewer.js#L2212-L2238 | train | |
openseadragon/openseadragon | src/viewer.js | beginControlsAutoHide | function beginControlsAutoHide( viewer ) {
if ( !viewer.autoHideControls ) {
return;
}
viewer.controlsShouldFade = true;
viewer.controlsFadeBeginTime =
$.now() +
viewer.controlsFadeDelay;
window.setTimeout( function(){
scheduleControlsFade( viewer );
}, viewer.co... | javascript | function beginControlsAutoHide( viewer ) {
if ( !viewer.autoHideControls ) {
return;
}
viewer.controlsShouldFade = true;
viewer.controlsFadeBeginTime =
$.now() +
viewer.controlsFadeDelay;
window.setTimeout( function(){
scheduleControlsFade( viewer );
}, viewer.co... | [
"function",
"beginControlsAutoHide",
"(",
"viewer",
")",
"{",
"if",
"(",
"!",
"viewer",
".",
"autoHideControls",
")",
"{",
"return",
";",
"}",
"viewer",
".",
"controlsShouldFade",
"=",
"true",
";",
"viewer",
".",
"controlsFadeBeginTime",
"=",
"$",
".",
"now"... | initiates an animation to hide the controls | [
"initiates",
"an",
"animation",
"to",
"hide",
"the",
"controls"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewer.js#L2451-L2463 | train |
openseadragon/openseadragon | src/viewer.js | updateControlsFade | 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 | function updateControlsFade( viewer ) {
var currentTime,
deltaTime,
opacity,
i;
if ( viewer.controlsShouldFade ) {
currentTime = $.now();
deltaTime = currentTime - viewer.controlsFadeBeginTime;
opacity = 1.0 - deltaTime / viewer.controlsFadeLength;
opacit... | [
"function",
"updateControlsFade",
"(",
"viewer",
")",
"{",
"var",
"currentTime",
",",
"deltaTime",
",",
"opacity",
",",
"i",
";",
"if",
"(",
"viewer",
".",
"controlsShouldFade",
")",
"{",
"currentTime",
"=",
"$",
".",
"now",
"(",
")",
";",
"deltaTime",
"... | determines if fade animation is done or continues the animation | [
"determines",
"if",
"fade",
"animation",
"is",
"done",
"or",
"continues",
"the",
"animation"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewer.js#L2467-L2491 | train |
openseadragon/openseadragon | src/viewer.js | abortControlsAutoHide | function abortControlsAutoHide( viewer ) {
var i;
viewer.controlsShouldFade = false;
for ( i = viewer.controls.length - 1; i >= 0; i-- ) {
viewer.controls[ i ].setOpacity( 1.0 );
}
} | javascript | function abortControlsAutoHide( viewer ) {
var i;
viewer.controlsShouldFade = false;
for ( i = viewer.controls.length - 1; i >= 0; i-- ) {
viewer.controls[ i ].setOpacity( 1.0 );
}
} | [
"function",
"abortControlsAutoHide",
"(",
"viewer",
")",
"{",
"var",
"i",
";",
"viewer",
".",
"controlsShouldFade",
"=",
"false",
";",
"for",
"(",
"i",
"=",
"viewer",
".",
"controls",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",... | stop the fade animation on the controls and show them | [
"stop",
"the",
"fade",
"animation",
"on",
"the",
"controls",
"and",
"show",
"them"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewer.js#L2495-L2501 | train |
openseadragon/openseadragon | src/mousetracker.js | 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 | function () {
var i;
stopTracking( this );
this.element = null;
for ( i = 0; i < MOUSETRACKERS.length; i++ ) {
if ( MOUSETRACKERS[ i ] === this ) {
MOUSETRACKERS.splice( i, 1 );
break;
}
... | [
"function",
"(",
")",
"{",
"var",
"i",
";",
"stopTracking",
"(",
"this",
")",
";",
"this",
".",
"element",
"=",
"null",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"MOUSETRACKERS",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"MOUSETR... | Clean up any events or objects created by the tracker.
@function | [
"Clean",
"up",
"any",
"events",
"or",
"objects",
"created",
"by",
"the",
"tracker",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/mousetracker.js#L277-L292 | train | |
openseadragon/openseadragon | src/mousetracker.js | 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 | 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;... | [
"function",
"(",
")",
"{",
"var",
"delegate",
"=",
"THIS",
"[",
"this",
".",
"hash",
"]",
",",
"i",
",",
"len",
"=",
"delegate",
".",
"activePointersLists",
".",
"length",
",",
"count",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"... | Returns the total number of pointers currently active on the tracked element.
@function
@returns {Number} | [
"Returns",
"the",
"total",
"number",
"of",
"pointers",
"currently",
"active",
"on",
"the",
"tracked",
"element",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/mousetracker.js#L368-L379 | train | |
openseadragon/openseadragon | src/mousetracker.js | function ( tracker, gPoint ) {
return tracker.hash.toString() + gPoint.type + gPoint.id.toString();
} | javascript | function ( tracker, gPoint ) {
return tracker.hash.toString() + gPoint.type + gPoint.id.toString();
} | [
"function",
"(",
"tracker",
",",
"gPoint",
")",
"{",
"return",
"tracker",
".",
"hash",
".",
"toString",
"(",
")",
"+",
"gPoint",
".",
"type",
"+",
"gPoint",
".",
"id",
".",
"toString",
"(",
")",
";",
"}"
] | Generates a unique identifier for a tracked gesture point | [
"Generates",
"a",
"unique",
"identifier",
"for",
"a",
"tracked",
"gesture",
"point"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/mousetracker.js#L915-L917 | train | |
openseadragon/openseadragon | src/mousetracker.js | function () {
var i,
len = trackerPoints.length,
trackPoint,
gPoint,
now = $.now(),
elapsedTime,
distance,
speed;
elapsedTime = now - lastTime;
lastTime = now;
... | javascript | function () {
var i,
len = trackerPoints.length,
trackPoint,
gPoint,
now = $.now(),
elapsedTime,
distance,
speed;
elapsedTime = now - lastTime;
lastTime = now;
... | [
"function",
"(",
")",
"{",
"var",
"i",
",",
"len",
"=",
"trackerPoints",
".",
"length",
",",
"trackPoint",
",",
"gPoint",
",",
"now",
"=",
"$",
".",
"now",
"(",
")",
",",
"elapsedTime",
",",
"distance",
",",
"speed",
";",
"elapsedTime",
"=",
"now",
... | Interval timer callback. Computes velocity for all tracked gesture points. | [
"Interval",
"timer",
"callback",
".",
"Computes",
"velocity",
"for",
"all",
"tracked",
"gesture",
"points",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/mousetracker.js#L920-L946 | train | |
openseadragon/openseadragon | src/mousetracker.js | function ( tracker, gPoint ) {
var guid = _generateGuid( tracker, gPoint );
trackerPoints.push(
{
guid: guid,
gPoint: gPoint,
lastPos: gPoint.currentPos
} );
// Only fire up the interval tim... | javascript | function ( tracker, gPoint ) {
var guid = _generateGuid( tracker, gPoint );
trackerPoints.push(
{
guid: guid,
gPoint: gPoint,
lastPos: gPoint.currentPos
} );
// Only fire up the interval tim... | [
"function",
"(",
"tracker",
",",
"gPoint",
")",
"{",
"var",
"guid",
"=",
"_generateGuid",
"(",
"tracker",
",",
"gPoint",
")",
";",
"trackerPoints",
".",
"push",
"(",
"{",
"guid",
":",
"guid",
",",
"gPoint",
":",
"gPoint",
",",
"lastPos",
":",
"gPoint",... | Public. Add a gesture point to be tracked | [
"Public",
".",
"Add",
"a",
"gesture",
"point",
"to",
"be",
"tracked"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/mousetracker.js#L949-L964 | train | |
openseadragon/openseadragon | src/mousetracker.js | 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 | 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 );
... | [
"function",
"(",
"tracker",
",",
"gPoint",
")",
"{",
"var",
"guid",
"=",
"_generateGuid",
"(",
"tracker",
",",
"gPoint",
")",
",",
"i",
",",
"len",
"=",
"trackerPoints",
".",
"length",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i... | Public. Stop tracking a gesture point | [
"Public",
".",
"Stop",
"tracking",
"a",
"gesture",
"point"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/mousetracker.js#L967-L982 | train | |
openseadragon/openseadragon | src/mousetracker.js | startTracking | 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 | 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(
... | [
"function",
"startTracking",
"(",
"tracker",
")",
"{",
"var",
"delegate",
"=",
"THIS",
"[",
"tracker",
".",
"hash",
"]",
",",
"event",
",",
"i",
";",
"if",
"(",
"!",
"delegate",
".",
"tracking",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",... | Starts tracking pointer events on the tracked element.
@private
@inner | [
"Starts",
"tracking",
"pointer",
"events",
"on",
"the",
"tracked",
"element",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/mousetracker.js#L1335-L1355 | train |
openseadragon/openseadragon | src/mousetracker.js | stopTracking | 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 | 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(
... | [
"function",
"stopTracking",
"(",
"tracker",
")",
"{",
"var",
"delegate",
"=",
"THIS",
"[",
"tracker",
".",
"hash",
"]",
",",
"event",
",",
"i",
";",
"if",
"(",
"delegate",
".",
"tracking",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"$",
... | Stops tracking pointer events on the tracked element.
@private
@inner | [
"Stops",
"tracking",
"pointer",
"events",
"on",
"the",
"tracked",
"element",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/mousetracker.js#L1362-L1382 | train |
openseadragon/openseadragon | src/mousetracker.js | capturePointer | function capturePointer( tracker, pointerType, pointerCount ) {
var pointsList = tracker.getActivePointersListByType( pointerType ),
eventParams;
pointsList.captureCount += (pointerCount || 1);
if ( pointsList.captureCount === 1 ) {
if ( $.Browser.vendor === $.BROWSERS.... | javascript | function capturePointer( tracker, pointerType, pointerCount ) {
var pointsList = tracker.getActivePointersListByType( pointerType ),
eventParams;
pointsList.captureCount += (pointerCount || 1);
if ( pointsList.captureCount === 1 ) {
if ( $.Browser.vendor === $.BROWSERS.... | [
"function",
"capturePointer",
"(",
"tracker",
",",
"pointerType",
",",
"pointerCount",
")",
"{",
"var",
"pointsList",
"=",
"tracker",
".",
"getActivePointersListByType",
"(",
"pointerType",
")",
",",
"eventParams",
";",
"pointsList",
".",
"captureCount",
"+=",
"("... | Begin capturing pointer events to the tracked element.
@private
@inner | [
"Begin",
"capturing",
"pointer",
"events",
"to",
"the",
"tracked",
"element",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/mousetracker.js#L1422-L1458 | train |
openseadragon/openseadragon | src/mousetracker.js | onMouseWheel | 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 | 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... | [
"function",
"onMouseWheel",
"(",
"tracker",
",",
"event",
")",
"{",
"event",
"=",
"$",
".",
"getEvent",
"(",
"event",
")",
";",
"// Simulate a 'wheel' event",
"var",
"simulatedEvent",
"=",
"{",
"target",
":",
"event",
".",
"target",
"||",
"event",
".",
"sr... | Handler for 'mousewheel', 'DOMMouseScroll', and 'MozMousePixelScroll' events
@private
@inner | [
"Handler",
"for",
"mousewheel",
"DOMMouseScroll",
"and",
"MozMousePixelScroll",
"events"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/mousetracker.js#L1751-L1776 | train |
openseadragon/openseadragon | src/tile.js | 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 | 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... | [
"function",
"(",
"container",
")",
"{",
"if",
"(",
"!",
"this",
".",
"cacheImageRecord",
")",
"{",
"$",
".",
"console",
".",
"warn",
"(",
"'[Tile.drawHTML] attempting to draw tile %s when it\\'s not cached'",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"... | Renders the tile in an html container.
@function
@param {Element} container | [
"Renders",
"the",
"tile",
"in",
"an",
"html",
"container",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/tile.js#L258-L300 | train | |
openseadragon/openseadragon | src/tile.js | 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 | 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... | [
"function",
"(",
"context",
",",
"drawingHandler",
",",
"scale",
",",
"translate",
")",
"{",
"var",
"position",
"=",
"this",
".",
"position",
".",
"times",
"(",
"$",
".",
"pixelDensityRatio",
")",
",",
"size",
"=",
"this",
".",
"size",
".",
"times",
"(... | Renders the tile in a canvas-based context.
@function
@param {Canvas} context
@param {Function} drawingHandler - Method for firing the drawing event.
drawingHandler({context, tile, rendered})
where <code>rendered</code> is the context with the pre-drawn image.
@param {Number} [scale=1] - Apply a scale to position and s... | [
"Renders",
"the",
"tile",
"in",
"a",
"canvas",
"-",
"based",
"context",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/tile.js#L312-L392 | train | |
openseadragon/openseadragon | src/tile.js | 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 | 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... | [
"function",
"(",
")",
"{",
"var",
"context",
";",
"if",
"(",
"this",
".",
"cacheImageRecord",
")",
"{",
"context",
"=",
"this",
".",
"cacheImageRecord",
".",
"getRenderedContext",
"(",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"context2D",
")",
"{... | Get the ratio between current and original size.
@function
@return {Float} | [
"Get",
"the",
"ratio",
"between",
"current",
"and",
"original",
"size",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/tile.js#L399-L412 | train | |
openseadragon/openseadragon | src/tile.js | 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 | 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:
//... | [
"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 t... | Get a translation vector that when applied to the tile position produces integer coordinates.
Needed to avoid swimming and twitching.
@function
@param {Number} [scale=1] - Scale to be applied to position.
@return {OpenSeadragon.Point} | [
"Get",
"a",
"translation",
"vector",
"that",
"when",
"applied",
"to",
"the",
"tile",
"position",
"produces",
"integer",
"coordinates",
".",
"Needed",
"to",
"avoid",
"swimming",
"and",
"twitching",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/tile.js#L421-L436 | train | |
openseadragon/openseadragon | src/tile.js | 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 | 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... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"imgElement",
"&&",
"this",
".",
"imgElement",
".",
"parentNode",
")",
"{",
"this",
".",
"imgElement",
".",
"parentNode",
".",
"removeChild",
"(",
"this",
".",
"imgElement",
")",
";",
"}",
"if",
"(",
... | Removes tile from its container.
@function | [
"Removes",
"tile",
"from",
"its",
"container",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/tile.js#L442-L454 | train | |
openseadragon/openseadragon | src/world.js | 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 | 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... | [
"function",
"(",
"item",
",",
"options",
")",
"{",
"$",
".",
"console",
".",
"assert",
"(",
"item",
",",
"\"[World.addItem] item is required\"",
")",
";",
"$",
".",
"console",
".",
"assert",
"(",
"item",
"instanceof",
"$",
".",
"TiledImage",
",",
"\"[World... | Add the specified item.
@param {OpenSeadragon.TiledImage} item - The item to add.
@param {Number} [options.index] - Index for the item. If not specified, goes at the top.
@fires OpenSeadragon.World.event:add-item
@fires OpenSeadragon.World.event:metrics-change | [
"Add",
"the",
"specified",
"item",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/world.js#L76-L111 | train | |
openseadragon/openseadragon | src/world.js | 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 | 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... | [
"function",
"(",
"item",
",",
"index",
")",
"{",
"$",
".",
"console",
".",
"assert",
"(",
"item",
",",
"\"[World.setItemIndex] item is required\"",
")",
";",
"$",
".",
"console",
".",
"assert",
"(",
"index",
"!==",
"undefined",
",",
"\"[World.setItemIndex] ind... | Change the index of a item so that it appears over or under others.
@param {OpenSeadragon.TiledImage} item - The item to move.
@param {Number} index - The new index.
@fires OpenSeadragon.World.event:item-index-change | [
"Change",
"the",
"index",
"of",
"a",
"item",
"so",
"that",
"it",
"appears",
"over",
"or",
"under",
"others",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/world.js#L146-L181 | train | |
openseadragon/openseadragon | src/world.js | 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 | 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... | [
"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",
... | Remove all items.
@fires OpenSeadragon.World.event:remove-item
@fires OpenSeadragon.World.event:metrics-change | [
"Remove",
"all",
"items",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/world.js#L211-L232 | train | |
openseadragon/openseadragon | src/world.js | function() {
for ( var i = 0; i < this._items.length; i++ ) {
this._items[i].draw();
}
this._needsDraw = false;
} | javascript | function() {
for ( var i = 0; i < this._items.length; i++ ) {
this._items[i].draw();
}
this._needsDraw = false;
} | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_items",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"_items",
"[",
"i",
"]",
".",
"draw",
"(",
")",
";",
"}",
"this",
".",
"_needsDraw",
"=... | Draws all items. | [
"Draws",
"all",
"items",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/world.js#L258-L264 | train | |
openseadragon/openseadragon | src/world.js | 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 | 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... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"immediately",
"=",
"options",
".",
"immediately",
"||",
"false",
";",
"var",
"layout",
"=",
"options",
".",
"layout",
"||",
"$",
".",
"DEFAULT_SETTINGS",
".",
... | Arranges all of the TiledImages with the specified settings.
@param {Object} options - Specifies how to arrange.
@param {Boolean} [options.immediately=false] - Whether to animate to the new arrangement.
@param {String} [options.layout] - See collectionLayout in {@link OpenSeadragon.Options}.
@param {Number} [options.ro... | [
"Arranges",
"all",
"of",
"the",
"TiledImages",
"with",
"the",
"specified",
"settings",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/world.js#L321-L374 | train | |
openseadragon/openseadragon | src/overlay.js | 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 | function(position, size) {
var properties = $.Placement.properties[this.placement];
if (!properties) {
return;
}
if (properties.isHorizontallyCentered) {
position.x -= size.x / 2;
} else if (properties.isRight) {
... | [
"function",
"(",
"position",
",",
"size",
")",
"{",
"var",
"properties",
"=",
"$",
".",
"Placement",
".",
"properties",
"[",
"this",
".",
"placement",
"]",
";",
"if",
"(",
"!",
"properties",
")",
"{",
"return",
";",
"}",
"if",
"(",
"properties",
".",... | Internal function to adjust the position of an overlay
depending on it size and placement.
@function
@param {OpenSeadragon.Point} position
@param {OpenSeadragon.Point} size | [
"Internal",
"function",
"to",
"adjust",
"the",
"position",
"of",
"an",
"overlay",
"depending",
"on",
"it",
"size",
"and",
"placement",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/overlay.js#L178-L193 | train | |
openseadragon/openseadragon | src/overlay.js | function(location, placement) {
var options = $.isPlainObject(location) ? location : {
location: location,
placement: placement
};
this._init({
location: options.location || this.location,
placement: options.placement !=... | javascript | function(location, placement) {
var options = $.isPlainObject(location) ? location : {
location: location,
placement: placement
};
this._init({
location: options.location || this.location,
placement: options.placement !=... | [
"function",
"(",
"location",
",",
"placement",
")",
"{",
"var",
"options",
"=",
"$",
".",
"isPlainObject",
"(",
"location",
")",
"?",
"location",
":",
"{",
"location",
":",
"location",
",",
"placement",
":",
"placement",
"}",
";",
"this",
".",
"_init",
... | Changes the overlay settings.
@function
@param {OpenSeadragon.Point|OpenSeadragon.Rect|Object} location
If an object is specified, the options are the same than the constructor
except for the element which can not be changed.
@param {OpenSeadragon.Placement} placement | [
"Changes",
"the",
"overlay",
"settings",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/overlay.js#L407-L422 | train | |
openseadragon/openseadragon | src/overlay.js | 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 | 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... | [
"function",
"(",
"viewport",
")",
"{",
"$",
".",
"console",
".",
"assert",
"(",
"viewport",
",",
"'A viewport must now be passed to Overlay.getBounds.'",
")",
";",
"var",
"width",
"=",
"this",
".",
"width",
";",
"var",
"height",
"=",
"this",
".",
"height",
"... | Returns the current bounds of the overlay in viewport coordinates
@function
@param {OpenSeadragon.Viewport} viewport the viewport
@returns {OpenSeadragon.Rect} overlay bounds | [
"Returns",
"the",
"current",
"bounds",
"of",
"the",
"overlay",
"in",
"viewport",
"coordinates"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/overlay.js#L430-L448 | train | |
openseadragon/openseadragon | src/referencestrip.js | function() {
if (this.miniViewers) {
for (var key in this.miniViewers) {
this.miniViewers[key].destroy();
}
}
if (this.element) {
this.element.parentNode.removeChild(this.element);
}
} | javascript | function() {
if (this.miniViewers) {
for (var key in this.miniViewers) {
this.miniViewers[key].destroy();
}
}
if (this.element) {
this.element.parentNode.removeChild(this.element);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"miniViewers",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"this",
".",
"miniViewers",
")",
"{",
"this",
".",
"miniViewers",
"[",
"key",
"]",
".",
"destroy",
"(",
")",
";",
"}",
"}",
"if",
"(",
"... | Overrides Viewer.destroy | [
"Overrides",
"Viewer",
".",
"destroy"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/referencestrip.js#L296-L306 | train | |
openseadragon/openseadragon | src/viewport.js | 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 | 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... | [
"function",
"(",
"contentSize",
")",
"{",
"$",
".",
"console",
".",
"assert",
"(",
"contentSize",
",",
"\"[Viewport.resetContentSize] contentSize is required\"",
")",
";",
"$",
".",
"console",
".",
"assert",
"(",
"contentSize",
"instanceof",
"$",
".",
"Point",
"... | Updates the viewport's home bounds and constraints for the given content size.
@function
@param {OpenSeadragon.Point} contentSize - size of the content in content units
@return {OpenSeadragon.Viewport} Chainable.
@fires OpenSeadragon.Viewer.event:reset-size | [
"Updates",
"the",
"viewport",
"s",
"home",
"bounds",
"and",
"constraints",
"for",
"the",
"given",
"content",
"size",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L153-L161 | train | |
openseadragon/openseadragon | src/viewport.js | 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 | 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.... | [
"function",
"(",
"bounds",
",",
"contentFactor",
")",
"{",
"$",
".",
"console",
".",
"assert",
"(",
"bounds",
",",
"\"[Viewport._setContentBounds] bounds is required\"",
")",
";",
"$",
".",
"console",
".",
"assert",
"(",
"bounds",
"instanceof",
"$",
".",
"Rect... | Set the viewport's content bounds @param {OpenSeadragon.Rect} bounds - the new bounds in viewport coordinates without rotation @param {Number} contentFactor - how many content units per viewport unit @fires OpenSeadragon.Viewer.event:reset-size @private | [
"Set",
"the",
"viewport",
"s",
"content",
"bounds"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L175-L212 | train | |
openseadragon/openseadragon | src/viewport.js | 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 | 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... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"defaultZoomLevel",
")",
"{",
"return",
"this",
".",
"defaultZoomLevel",
";",
"}",
"var",
"aspectFactor",
"=",
"this",
".",
"_contentAspectRatio",
"/",
"this",
".",
"getAspectRatio",
"(",
")",
";",
"var",
... | Returns the home zoom in "viewport zoom" value.
@function
@returns {Number} The home zoom in "viewport zoom". | [
"Returns",
"the",
"home",
"zoom",
"in",
"viewport",
"zoom",
"value",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L219-L233 | train | |
openseadragon/openseadragon | src/viewport.js | 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 | 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();
... | [
"function",
"(",
"margins",
")",
"{",
"$",
".",
"console",
".",
"assert",
"(",
"$",
".",
"type",
"(",
"margins",
")",
"===",
"'object'",
",",
"'[Viewport.setMargins] margins must be an object'",
")",
";",
"this",
".",
"_margins",
"=",
"$",
".",
"extend",
"... | The margins push the "home" region in from the sides by the specified amounts.
@function
@param {Object} margins - Properties (Numbers, in screen coordinates): left, top, right, bottom. | [
"The",
"margins",
"push",
"the",
"home",
"region",
"in",
"from",
"the",
"sides",
"by",
"the",
"specified",
"amounts",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L345-L359 | train | |
openseadragon/openseadragon | src/viewport.js | 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 | 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... | [
"function",
"(",
"immediately",
")",
"{",
"var",
"actualZoom",
"=",
"this",
".",
"getZoom",
"(",
")",
";",
"var",
"constrainedZoom",
"=",
"this",
".",
"_applyZoomConstraints",
"(",
"actualZoom",
")",
";",
"if",
"(",
"actualZoom",
"!==",
"constrainedZoom",
")... | Enforces the minZoom, maxZoom and visibilityRatio constraints by
zooming and panning to the closest acceptable zoom and location.
@function
@param {Boolean} [immediately=false]
@return {OpenSeadragon.Viewport} Chainable.
@fires OpenSeadragon.Viewer.event:constrain | [
"Enforces",
"the",
"minZoom",
"maxZoom",
"and",
"visibilityRatio",
"constraints",
"by",
"zooming",
"and",
"panning",
"to",
"the",
"closest",
"acceptable",
"zoom",
"and",
"location",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L570-L590 | train | |
openseadragon/openseadragon | src/viewport.js | 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 | 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);
} | [
"function",
"(",
"immediately",
")",
"{",
"var",
"box",
"=",
"new",
"$",
".",
"Rect",
"(",
"this",
".",
"_contentBounds",
".",
"x",
",",
"this",
".",
"_contentBounds",
".",
"y",
"+",
"(",
"this",
".",
"_contentBounds",
".",
"height",
"/",
"2",
")",
... | Zooms so the image just fills the viewer horizontally.
@param {Boolean} immediately
@return {OpenSeadragon.Viewport} Chainable. | [
"Zooms",
"so",
"the",
"image",
"just",
"fills",
"the",
"viewer",
"horizontally",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L736-L743 | train | |
openseadragon/openseadragon | src/viewport.js | function(current) {
var bounds,
constrainedBounds;
bounds = this.getBounds(current);
constrainedBounds = this._applyBoundaryConstraints(bounds);
return constrainedBounds;
} | javascript | function(current) {
var bounds,
constrainedBounds;
bounds = this.getBounds(current);
constrainedBounds = this._applyBoundaryConstraints(bounds);
return constrainedBounds;
} | [
"function",
"(",
"current",
")",
"{",
"var",
"bounds",
",",
"constrainedBounds",
";",
"bounds",
"=",
"this",
".",
"getBounds",
"(",
"current",
")",
";",
"constrainedBounds",
"=",
"this",
".",
"_applyBoundaryConstraints",
"(",
"bounds",
")",
";",
"return",
"c... | Returns bounds taking constraints into account
Added to improve constrained panning
@param {Boolean} current - Pass true for the current location; defaults to false (target location).
@return {OpenSeadragon.Viewport} Chainable. | [
"Returns",
"bounds",
"taking",
"constraints",
"into",
"account",
"Added",
"to",
"improve",
"constrained",
"panning"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L752-L761 | train | |
openseadragon/openseadragon | src/viewport.js | 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 | 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() ... | [
"function",
"(",
"zoom",
",",
"refPoint",
",",
"immediately",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"this",
".",
"zoomPoint",
"=",
"refPoint",
"instanceof",
"$",
".",
"Point",
"&&",
"!",
"isNaN",
"(",
"refPoint",
".",
"x",
")",
"&&",
"!",
"isNa... | Zooms to the specified zoom level
@function
@param {Number} zoom The zoom level to zoom to.
@param {OpenSeadragon.Point} [refPoint] The point which will stay at
the same screen location. Defaults to the viewport center.
@param {Boolean} [immediately=false]
@return {OpenSeadragon.Viewport} Chainable.
@fires OpenSeadrago... | [
"Zooms",
"to",
"the",
"specified",
"zoom",
"level"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L835-L873 | train | |
openseadragon/openseadragon | src/viewport.js | 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 | 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... | [
"function",
"(",
"degrees",
")",
"{",
"if",
"(",
"!",
"this",
".",
"viewer",
"||",
"!",
"this",
".",
"viewer",
".",
"drawer",
".",
"canRotate",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"this",
".",
"degrees",
"=",
"$",
".",
"positiveModulo",... | Rotates this viewport to the angle specified.
@function
@return {OpenSeadragon.Viewport} Chainable. | [
"Rotates",
"this",
"viewport",
"to",
"the",
"angle",
"specified",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L880-L902 | train | |
openseadragon/openseadragon | src/viewport.js | 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 | 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()
);
} | [
"function",
"(",
"pixel",
",",
"current",
")",
"{",
"var",
"bounds",
"=",
"this",
".",
"getBoundsNoRotate",
"(",
"current",
")",
";",
"return",
"pixel",
".",
"minus",
"(",
"new",
"$",
".",
"Point",
"(",
"this",
".",
"_margins",
".",
"left",
",",
"thi... | Convert pixel coordinates to viewport coordinates.
This method does not take rotation into account.
Consider using pointFromPixel if you need to account for rotation.
@param {OpenSeadragon.Point} pixel Pixel coordinates
@param {Boolean} [current=false] - Pass true for the current location;
defaults to false (target loc... | [
"Convert",
"pixel",
"coordinates",
"to",
"viewport",
"coordinates",
".",
"This",
"method",
"does",
"not",
"take",
"rotation",
"into",
"account",
".",
"Consider",
"using",
"pointFromPixel",
"if",
"you",
"need",
"to",
"account",
"for",
"rotation",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L1119-L1128 | train | |
openseadragon/openseadragon | src/viewport.js | function(rectangle) {
return $.Rect.fromSummits(
this.pointFromPixel(rectangle.getTopLeft(), true),
this.pointFromPixel(rectangle.getTopRight(), true),
this.pointFromPixel(rectangle.getBottomLeft(), true)
);
} | javascript | function(rectangle) {
return $.Rect.fromSummits(
this.pointFromPixel(rectangle.getTopLeft(), true),
this.pointFromPixel(rectangle.getTopRight(), true),
this.pointFromPixel(rectangle.getBottomLeft(), true)
);
} | [
"function",
"(",
"rectangle",
")",
"{",
"return",
"$",
".",
"Rect",
".",
"fromSummits",
"(",
"this",
".",
"pointFromPixel",
"(",
"rectangle",
".",
"getTopLeft",
"(",
")",
",",
"true",
")",
",",
"this",
".",
"pointFromPixel",
"(",
"rectangle",
".",
"getTo... | Convert a rectangle in pixel coordinates relative to the viewer element
to viewport coordinates.
@param {OpenSeadragon.Rect} rectangle the rectangle to convert
@returns {OpenSeadragon.Rect} the converted rectangle | [
"Convert",
"a",
"rectangle",
"in",
"pixel",
"coordinates",
"relative",
"to",
"the",
"viewer",
"element",
"to",
"viewport",
"coordinates",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L1407-L1413 | train | |
openseadragon/openseadragon | src/viewport.js | function(rectangle) {
return $.Rect.fromSummits(
this.pixelFromPoint(rectangle.getTopLeft(), true),
this.pixelFromPoint(rectangle.getTopRight(), true),
this.pixelFromPoint(rectangle.getBottomLeft(), true)
);
} | javascript | function(rectangle) {
return $.Rect.fromSummits(
this.pixelFromPoint(rectangle.getTopLeft(), true),
this.pixelFromPoint(rectangle.getTopRight(), true),
this.pixelFromPoint(rectangle.getBottomLeft(), true)
);
} | [
"function",
"(",
"rectangle",
")",
"{",
"return",
"$",
".",
"Rect",
".",
"fromSummits",
"(",
"this",
".",
"pixelFromPoint",
"(",
"rectangle",
".",
"getTopLeft",
"(",
")",
",",
"true",
")",
",",
"this",
".",
"pixelFromPoint",
"(",
"rectangle",
".",
"getTo... | Convert a rectangle in viewport coordinates to pixel coordinates relative
to the viewer element.
@param {OpenSeadragon.Rect} rectangle the rectangle to convert
@returns {OpenSeadragon.Rect} the converted rectangle | [
"Convert",
"a",
"rectangle",
"in",
"viewport",
"coordinates",
"to",
"pixel",
"coordinates",
"relative",
"to",
"the",
"viewer",
"element",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L1421-L1427 | train | |
openseadragon/openseadragon | src/viewport.js | 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 | 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)... | [
"function",
"(",
"point",
")",
"{",
"$",
".",
"console",
".",
"assert",
"(",
"this",
".",
"viewer",
",",
"\"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.\"",
")",
";",
"var",
"viewerCoordinates",
"=",
"this",
".",
"viewportToViewerElementCoordi... | Convert viewport coordinates to pixel coordinates relative to the window.
@param {OpenSeadragon.Point} point
@returns {OpenSeadragon.Point} | [
"Convert",
"viewport",
"coordinates",
"to",
"pixel",
"coordinates",
"relative",
"to",
"the",
"window",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L1447-L1453 | train | |
openseadragon/openseadragon | src/viewport.js | 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 | 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.
*
... | [
"function",
"(",
"state",
")",
"{",
"if",
"(",
"this",
".",
"flipped",
"===",
"state",
")",
"{",
"return",
"this",
";",
"}",
"this",
".",
"flipped",
"=",
"state",
";",
"if",
"(",
"this",
".",
"viewer",
".",
"navigator",
")",
"{",
"this",
".",
"vi... | Sets flip state according to the state input argument.
@function
@param {Boolean} state - Flip state to set.
@return {OpenSeadragon.Viewport} Chainable. | [
"Sets",
"flip",
"state",
"according",
"to",
"the",
"state",
"input",
"argument",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/viewport.js#L1548-L1571 | train | |
openseadragon/openseadragon | src/imagetilesource.js | function (level, x, y) {
var url = null;
if (level >= this.minLevel && level <= this.maxLevel) {
url = this.levels[level].url;
}
return url;
} | javascript | function (level, x, y) {
var url = null;
if (level >= this.minLevel && level <= this.maxLevel) {
url = this.levels[level].url;
}
return url;
} | [
"function",
"(",
"level",
",",
"x",
",",
"y",
")",
"{",
"var",
"url",
"=",
"null",
";",
"if",
"(",
"level",
">=",
"this",
".",
"minLevel",
"&&",
"level",
"<=",
"this",
".",
"maxLevel",
")",
"{",
"url",
"=",
"this",
".",
"levels",
"[",
"level",
... | Retrieves a tile url
@function
@param {Number} level Level of the tile
@param {Number} x x coordinate of the tile
@param {Number} y y coordinate of the tile | [
"Retrieves",
"a",
"tile",
"url"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/imagetilesource.js#L177-L183 | train | |
openseadragon/openseadragon | src/imagetilesource.js | function (level, x, y) {
var context = null;
if (level >= this.minLevel && level <= this.maxLevel) {
context = this.levels[level].context2D;
}
return context;
} | javascript | function (level, x, y) {
var context = null;
if (level >= this.minLevel && level <= this.maxLevel) {
context = this.levels[level].context2D;
}
return context;
} | [
"function",
"(",
"level",
",",
"x",
",",
"y",
")",
"{",
"var",
"context",
"=",
"null",
";",
"if",
"(",
"level",
">=",
"this",
".",
"minLevel",
"&&",
"level",
"<=",
"this",
".",
"maxLevel",
")",
"{",
"context",
"=",
"this",
".",
"levels",
"[",
"le... | Retrieves a tile context 2D
@function
@param {Number} level Level of the tile
@param {Number} x x coordinate of the tile
@param {Number} y y coordinate of the tile | [
"Retrieves",
"a",
"tile",
"context",
"2D"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/imagetilesource.js#L191-L197 | train | |
openseadragon/openseadragon | src/imageloader.js | 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 | 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... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"selfAbort",
"=",
"this",
".",
"abort",
";",
"this",
".",
"image",
"=",
"new",
"Image",
"(",
")",
";",
"this",
".",
"image",
".",
"onload",
"=",
"function",
"(",
")",
"{",
"self",... | Starts the image job.
@method | [
"Starts",
"the",
"image",
"job",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/imageloader.js#L72-L151 | train | |
openseadragon/openseadragon | src/imageloader.js | function(options) {
var _this = this,
complete = function(job) {
completeJob(_this, job, options.callback);
},
jobOptions = {
src: options.src,
loadWithAjax: options.loadWithAjax,
ajaxHeaders: options.loadWithAja... | javascript | function(options) {
var _this = this,
complete = function(job) {
completeJob(_this, job, options.callback);
},
jobOptions = {
src: options.src,
loadWithAjax: options.loadWithAjax,
ajaxHeaders: options.loadWithAja... | [
"function",
"(",
"options",
")",
"{",
"var",
"_this",
"=",
"this",
",",
"complete",
"=",
"function",
"(",
"job",
")",
"{",
"completeJob",
"(",
"_this",
",",
"job",
",",
"options",
".",
"callback",
")",
";",
"}",
",",
"jobOptions",
"=",
"{",
"src",
... | Add an unloaded image to the loader queue.
@method
@param {Object} options - Options for this job.
@param {String} [options.src] - URL of image to download.
@param {String} [options.loadWithAjax] - Whether to load this image with AJAX.
@param {String} [options.ajaxHeaders] - Headers to add to the image request if using... | [
"Add",
"an",
"unloaded",
"image",
"to",
"the",
"loader",
"queue",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/imageloader.js#L204-L228 | train | |
openseadragon/openseadragon | src/imageloader.js | 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 | function() {
for( var i = 0; i < this.jobQueue.length; i++ ) {
var job = this.jobQueue[i];
if ( typeof job.abort === "function" ) {
job.abort();
}
}
this.jobQueue = [];
} | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"jobQueue",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"job",
"=",
"this",
".",
"jobQueue",
"[",
"i",
"]",
";",
"if",
"(",
"typeof",
"job",
".",
"... | Clear any unstarted image loading jobs from the queue.
@method | [
"Clear",
"any",
"unstarted",
"image",
"loading",
"jobs",
"from",
"the",
"queue",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/imageloader.js#L234-L243 | train | |
openseadragon/openseadragon | src/imageloader.js | completeJob | 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 | 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... | [
"function",
"completeJob",
"(",
"loader",
",",
"job",
",",
"callback",
")",
"{",
"var",
"nextJob",
";",
"loader",
".",
"jobsInProgress",
"--",
";",
"if",
"(",
"(",
"!",
"loader",
".",
"jobLimit",
"||",
"loader",
".",
"jobsInProgress",
"<",
"loader",
".",... | Cleans up ImageJob once completed.
@method
@private
@param loader - ImageLoader used to start job.
@param job - The ImageJob that has completed.
@param callback - Called once cleanup is finished. | [
"Cleans",
"up",
"ImageJob",
"once",
"completed",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/imageloader.js#L254-L266 | train |
openseadragon/openseadragon | src/iiiftilesource.js | 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 | 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 ... | [
"function",
"(",
"level",
")",
"{",
"if",
"(",
"this",
".",
"emulateLegacyImagePyramid",
")",
"{",
"return",
"$",
".",
"TileSource",
".",
"prototype",
".",
"getTileWidth",
".",
"call",
"(",
"this",
",",
"level",
")",
";",
"}",
"var",
"scaleFactor",
"=",
... | Return the tileWidth for the given level.
@function
@param {Number} level | [
"Return",
"the",
"tileWidth",
"for",
"the",
"given",
"level",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/iiiftilesource.js#L219-L231 | train | |
openseadragon/openseadragon | src/iiiftilesource.js | 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 | 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... | [
"function",
"(",
"level",
")",
"{",
"if",
"(",
"this",
".",
"emulateLegacyImagePyramid",
")",
"{",
"return",
"$",
".",
"TileSource",
".",
"prototype",
".",
"getTileHeight",
".",
"call",
"(",
"this",
",",
"level",
")",
";",
"}",
"var",
"scaleFactor",
"=",... | Return the tileHeight for the given level.
@function
@param {Number} level | [
"Return",
"the",
"tileHeight",
"for",
"the",
"given",
"level",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/iiiftilesource.js#L238-L250 | train | |
openseadragon/openseadragon | src/iiiftilesource.js | 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 | 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
... | [
"function",
"(",
"level",
",",
"x",
",",
"y",
")",
"{",
"if",
"(",
"this",
".",
"emulateLegacyImagePyramid",
")",
"{",
"var",
"url",
"=",
"null",
";",
"if",
"(",
"this",
".",
"levels",
".",
"length",
">",
"0",
"&&",
"level",
">=",
"this",
".",
"m... | Responsible for retrieving the url which will return an image for the
region specified by the given x, y, and level components.
@function
@param {Number} level - z index
@param {Number} x
@param {Number} y
@throws {Error} | [
"Responsible",
"for",
"retrieving",
"the",
"url",
"which",
"will",
"return",
"an",
"image",
"for",
"the",
"region",
"specified",
"by",
"the",
"given",
"x",
"y",
"and",
"level",
"components",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/iiiftilesource.js#L314-L388 | train | |
openseadragon/openseadragon | src/iiiftilesource.js | canBeTiled | 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 | 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... | [
"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... | Determine whether arbitrary tile requests can be made against a service with the given profile
@function
@param {array} profile - IIIF profile array
@throws {Error} | [
"Determine",
"whether",
"arbitrary",
"tile",
"requests",
"can",
"be",
"made",
"against",
"a",
"service",
"with",
"the",
"given",
"profile"
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/iiiftilesource.js#L398-L410 | train |
openseadragon/openseadragon | src/eventsource.js | 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 | 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 };
... | [
"function",
"(",
"eventName",
",",
"handler",
",",
"userData",
")",
"{",
"var",
"events",
"=",
"this",
".",
"events",
"[",
"eventName",
"]",
";",
"if",
"(",
"!",
"events",
")",
"{",
"this",
".",
"events",
"[",
"eventName",
"]",
"=",
"events",
"=",
... | Add an event handler for a given event.
@function
@param {String} eventName - Name of event to register.
@param {OpenSeadragon.EventHandler} handler - Function to call when event is triggered.
@param {Object} [userData=null] - Arbitrary object to be passed unchanged to the handler. | [
"Add",
"an",
"event",
"handler",
"for",
"a",
"given",
"event",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/eventsource.js#L92-L100 | train | |
openseadragon/openseadragon | src/eventsource.js | 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 | 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 ) ... | [
"function",
"(",
"eventName",
",",
"handler",
")",
"{",
"var",
"events",
"=",
"this",
".",
"events",
"[",
"eventName",
"]",
",",
"handlers",
"=",
"[",
"]",
",",
"i",
";",
"if",
"(",
"!",
"events",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"... | Remove a specific event handler for a given event.
@function
@param {String} eventName - Name of event for which the handler is to be removed.
@param {OpenSeadragon.EventHandler} handler - Function to be removed. | [
"Remove",
"a",
"specific",
"event",
"handler",
"for",
"a",
"given",
"event",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/eventsource.js#L108-L123 | train | |
openseadragon/openseadragon | src/eventsource.js | 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 | 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... | [
"function",
"(",
"eventName",
")",
"{",
"var",
"events",
"=",
"this",
".",
"events",
"[",
"eventName",
"]",
";",
"if",
"(",
"!",
"events",
"||",
"!",
"events",
".",
"length",
")",
"{",
"return",
"null",
";",
"}",
"events",
"=",
"events",
".",
"leng... | Get a function which iterates the list of all handlers registered for a given event, calling the handler for each.
@function
@param {String} eventName - Name of event to get handlers for. | [
"Get",
"a",
"function",
"which",
"iterates",
"the",
"list",
"of",
"all",
"handlers",
"registered",
"for",
"a",
"given",
"event",
"calling",
"the",
"handler",
"for",
"each",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/eventsource.js#L147-L166 | train | |
openseadragon/openseadragon | src/eventsource.js | 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 | 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... | [
"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",
"(",
... | Trigger an event, optionally passing additional information.
@function
@param {String} eventName - Name of event to register.
@param {Object} eventArgs - Event-specific data. | [
"Trigger",
"an",
"event",
"optionally",
"passing",
"additional",
"information",
"."
] | e7108f23602575fc6eb152d4b82a8b44b2ca698e | https://github.com/openseadragon/openseadragon/blob/e7108f23602575fc6eb152d4b82a8b44b2ca698e/src/eventsource.js#L174-L186 | train | |
mlaursen/react-md | docs/src/scripts/createDocgen.js | createDocgen | 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 | 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 ... | [
"async",
"function",
"createDocgen",
"(",
")",
"{",
"const",
"customPropTypes",
"=",
"await",
"getCustomPropTypes",
"(",
")",
";",
"const",
"components",
"=",
"await",
"getDocumentableComponents",
"(",
")",
";",
"const",
"propTypesDatabase",
"=",
"getPropTypeLinks",... | Creates the "database" file of all the documentation for the components. | [
"Creates",
"the",
"database",
"file",
"of",
"all",
"the",
"documentation",
"for",
"the",
"components",
"."
] | 28c78cac8cdaa3d9832a05025bdf50050627e23b | https://github.com/mlaursen/react-md/blob/28c78cac8cdaa3d9832a05025bdf50050627e23b/docs/src/scripts/createDocgen.js#L19-L53 | train |
mlaursen/react-md | docs/src/scripts/utils/getSassDocLinks.js | findLink | 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 | 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;
} | [
"function",
"findLink",
"(",
"ref",
")",
"{",
"if",
"(",
"lastLink",
".",
"indexOf",
"(",
"ref",
")",
"!==",
"-",
"1",
")",
"{",
"return",
"lastLink",
";",
"}",
"lastLink",
"=",
"''",
";",
"routes",
".",
"some",
"(",
"(",
"link",
")",
"=>",
"{",
... | "Lazily" finds the link to use for a sassdoc. It attempts to match the `lastLink`,
but otherwise searches the `LINKS` for a match.
@param {String} ref - the ref to match with
@return {String} link - the link to use for the ref. | [
"Lazily",
"finds",
"the",
"link",
"to",
"use",
"for",
"a",
"sassdoc",
".",
"It",
"attempts",
"to",
"match",
"the",
"lastLink",
"but",
"otherwise",
"searches",
"the",
"LINKS",
"for",
"a",
"match",
"."
] | 28c78cac8cdaa3d9832a05025bdf50050627e23b | https://github.com/mlaursen/react-md/blob/28c78cac8cdaa3d9832a05025bdf50050627e23b/docs/src/scripts/utils/getSassDocLinks.js#L21-L36 | train |
mlaursen/react-md | docs/src/server/api/github.js | githubProxy | 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 | 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... | [
"async",
"function",
"githubProxy",
"(",
"req",
",",
"res",
")",
"{",
"const",
"response",
"=",
"await",
"fetchGithub",
"(",
"req",
".",
"url",
",",
"{",
"headers",
"}",
")",
";",
"setHeader",
"(",
"RATE_LIMIT",
",",
"res",
",",
"response",
")",
";",
... | Soo.. There's probably a better way to set up a proxy server, but that isn't
in my knowledge set. Anyways...
GitHub likes when you specify a custom User-Agent that contains your app name/username
when making api calls to help with debugging and other things. At the time of making
this server, the User-Agent header is ... | [
"Soo",
"..",
"There",
"s",
"probably",
"a",
"better",
"way",
"to",
"set",
"up",
"a",
"proxy",
"server",
"but",
"that",
"isn",
"t",
"in",
"my",
"knowledge",
"set",
".",
"Anyways",
"..."
] | 28c78cac8cdaa3d9832a05025bdf50050627e23b | https://github.com/mlaursen/react-md/blob/28c78cac8cdaa3d9832a05025bdf50050627e23b/docs/src/server/api/github.js#L32-L46 | train |
mlaursen/react-md | docs/src/utils/formatMarkdown/postTransforms.js | headerQuickLinkReplacer | function headerQuickLinkReplacer(fullMatch, openingTag, headerId, remainingHtml, headerText) {
const link = makeLink(headerId, headerText);
return `${openingTag} class="quick-link quick-link__container">${link}${remainingHtml}`;
} | javascript | function headerQuickLinkReplacer(fullMatch, openingTag, headerId, remainingHtml, headerText) {
const link = makeLink(headerId, headerText);
return `${openingTag} class="quick-link quick-link__container">${link}${remainingHtml}`;
} | [
"function",
"headerQuickLinkReplacer",
"(",
"fullMatch",
",",
"openingTag",
",",
"headerId",
",",
"remainingHtml",
",",
"headerText",
")",
"{",
"const",
"link",
"=",
"makeLink",
"(",
"headerId",
",",
"headerText",
")",
";",
"return",
"`",
"${",
"openingTag",
"... | Inserts the accessible quick link before any header tag and updates the header tag
to be a quick link container.
@param {String} fullMatch - The full match of the quick link regex.
@param {String} openingTag - This will be everything in the match
up to the first '>'. So something like: '<h1 id="h1"'
@param {String} he... | [
"Inserts",
"the",
"accessible",
"quick",
"link",
"before",
"any",
"header",
"tag",
"and",
"updates",
"the",
"header",
"tag",
"to",
"be",
"a",
"quick",
"link",
"container",
"."
] | 28c78cac8cdaa3d9832a05025bdf50050627e23b | https://github.com/mlaursen/react-md/blob/28c78cac8cdaa3d9832a05025bdf50050627e23b/docs/src/utils/formatMarkdown/postTransforms.js#L44-L47 | train |
mlaursen/react-md | src/js/SelectionControls/SelectionControlGroup.js | requiredByAllControls | 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 | 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);
... | [
"function",
"requiredByAllControls",
"(",
"validator",
")",
"{",
"return",
"function",
"validate",
"(",
"props",
",",
"propName",
",",
"component",
",",
"...",
"others",
")",
"{",
"let",
"err",
"=",
"validator",
"(",
"props",
",",
"propName",
",",
"component... | A custom PropTypes validator to make sure that each `control` in the `controls` prop
contains the given `propName`, or the `SelectionControlGroup` has defined that prop. | [
"A",
"custom",
"PropTypes",
"validator",
"to",
"make",
"sure",
"that",
"each",
"control",
"in",
"the",
"controls",
"prop",
"contains",
"the",
"given",
"propName",
"or",
"the",
"SelectionControlGroup",
"has",
"defined",
"that",
"prop",
"."
] | 28c78cac8cdaa3d9832a05025bdf50050627e23b | https://github.com/mlaursen/react-md/blob/28c78cac8cdaa3d9832a05025bdf50050627e23b/src/js/SelectionControls/SelectionControlGroup.js#L16-L38 | train |
transistorsoft/react-native-background-geolocation | scripts/xcode-helpers.js | getBuildProperty | function getBuildProperty(project, property) {
const firstTarget = project.getFirstTarget().firstTarget;
const configurationList = project.pbxXCConfigurationList()[
firstTarget.buildConfigurationList
];
const defaultBuildConfiguration = configurationList.buildConfigurations.reduce(
(acc,... | javascript | function getBuildProperty(project, property) {
const firstTarget = project.getFirstTarget().firstTarget;
const configurationList = project.pbxXCConfigurationList()[
firstTarget.buildConfigurationList
];
const defaultBuildConfiguration = configurationList.buildConfigurations.reduce(
(acc,... | [
"function",
"getBuildProperty",
"(",
"project",
",",
"property",
")",
"{",
"const",
"firstTarget",
"=",
"project",
".",
"getFirstTarget",
"(",
")",
".",
"firstTarget",
";",
"const",
"configurationList",
"=",
"project",
".",
"pbxXCConfigurationList",
"(",
")",
"[... | The getBuildProperty method of the 'xcode' project is a bit naive in that it doesn't take a specific target but iterates over all of them and doesn't have an exit condition if a property has been found. Which in the case of react-native projects usually is the tvOS target because it comes last. | [
"The",
"getBuildProperty",
"method",
"of",
"the",
"xcode",
"project",
"is",
"a",
"bit",
"naive",
"in",
"that",
"it",
"doesn",
"t",
"take",
"a",
"specific",
"target",
"but",
"iterates",
"over",
"all",
"of",
"them",
"and",
"doesn",
"t",
"have",
"an",
"exit... | 7c0836653222ee1dd7b6cf6a7b7215f556e63f7c | https://github.com/transistorsoft/react-native-background-geolocation/blob/7c0836653222ee1dd7b6cf6a7b7215f556e63f7c/scripts/xcode-helpers.js#L16-L35 | train |
transistorsoft/react-native-background-geolocation | scripts/xcode-helpers.js | getTargetAttributes | function getTargetAttributes(project, target) {
var attributes = project.getFirstProject()['firstProject']['attributes'];
target = target || project.getFirstTarget();
if (attributes['TargetAttributes'] === undefined) {
attributes['TargetAttributes'] = {};
}
if (attributes['TargetAttributes... | javascript | function getTargetAttributes(project, target) {
var attributes = project.getFirstProject()['firstProject']['attributes'];
target = target || project.getFirstTarget();
if (attributes['TargetAttributes'] === undefined) {
attributes['TargetAttributes'] = {};
}
if (attributes['TargetAttributes... | [
"function",
"getTargetAttributes",
"(",
"project",
",",
"target",
")",
"{",
"var",
"attributes",
"=",
"project",
".",
"getFirstProject",
"(",
")",
"[",
"'firstProject'",
"]",
"[",
"'attributes'",
"]",
";",
"target",
"=",
"target",
"||",
"project",
".",
"getF... | The node-xcode library doesn't offer a method to get all target attributes, so we'll have to implement it ourselves. | [
"The",
"node",
"-",
"xcode",
"library",
"doesn",
"t",
"offer",
"a",
"method",
"to",
"get",
"all",
"target",
"attributes",
"so",
"we",
"ll",
"have",
"to",
"implement",
"it",
"ourselves",
"."
] | 7c0836653222ee1dd7b6cf6a7b7215f556e63f7c | https://github.com/transistorsoft/react-native-background-geolocation/blob/7c0836653222ee1dd7b6cf6a7b7215f556e63f7c/scripts/xcode-helpers.js#L143-L156 | train |
pegjs/pegjs | tools/benchmark/index.js | dup | function dup( text, count ) {
let result = "";
for ( let i = 1; i <= count; i++ ) result += text;
return result;
} | javascript | function dup( text, count ) {
let result = "";
for ( let i = 1; i <= count; i++ ) result += text;
return result;
} | [
"function",
"dup",
"(",
"text",
",",
"count",
")",
"{",
"let",
"result",
"=",
"\"\"",
";",
"for",
"(",
"let",
"i",
"=",
"1",
";",
"i",
"<=",
"count",
";",
"i",
"++",
")",
"result",
"+=",
"text",
";",
"return",
"result",
";",
"}"
] | Results Table Manipulation | [
"Results",
"Table",
"Manipulation"
] | 30f32600084d8da6a50b801edad49619e53e2a05 | https://github.com/pegjs/pegjs/blob/30f32600084d8da6a50b801edad49619e53e2a05/tools/benchmark/index.js#L10-L18 | train |
pegjs/pegjs | packages/pegjs/lib/compiler/passes/report-undefined-rules.js | reportUndefinedRules | 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 | 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
... | [
"function",
"reportUndefinedRules",
"(",
"ast",
",",
"session",
",",
"options",
")",
"{",
"const",
"check",
"=",
"session",
".",
"buildVisitor",
"(",
"{",
"rule_ref",
"(",
"node",
")",
"{",
"if",
"(",
"!",
"ast",
".",
"findRule",
"(",
"node",
".",
"nam... | Checks that all referenced rules exist. | [
"Checks",
"that",
"all",
"referenced",
"rules",
"exist",
"."
] | 30f32600084d8da6a50b801edad49619e53e2a05 | https://github.com/pegjs/pegjs/blob/30f32600084d8da6a50b801edad49619e53e2a05/packages/pegjs/lib/compiler/passes/report-undefined-rules.js#L4-L33 | train |
pegjs/pegjs | packages/pegjs/lib/compiler/passes/calc-report-failures.js | calcReportFailures | 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 | 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... | [
"function",
"calcReportFailures",
"(",
"ast",
",",
"session",
",",
"options",
")",
"{",
"// By default, not report failures for rules...",
"ast",
".",
"rules",
".",
"forEach",
"(",
"rule",
"=>",
"{",
"rule",
".",
"reportFailures",
"=",
"false",
";",
"}",
")",
... | Determines if rule always used in disabled report failure context, that means, that any failures, reported within it, are never will be visible, so the no need to report it. | [
"Determines",
"if",
"rule",
"always",
"used",
"in",
"disabled",
"report",
"failure",
"context",
"that",
"means",
"that",
"any",
"failures",
"reported",
"within",
"it",
"are",
"never",
"will",
"be",
"visible",
"so",
"the",
"no",
"need",
"to",
"report",
"it",
... | 30f32600084d8da6a50b801edad49619e53e2a05 | https://github.com/pegjs/pegjs/blob/30f32600084d8da6a50b801edad49619e53e2a05/packages/pegjs/lib/compiler/passes/calc-report-failures.js#L6-L63 | train |
pegjs/pegjs | packages/pegjs/lib/compiler/passes/report-duplicate-labels.js | reportDuplicateLabels | 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 | 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... | [
"function",
"reportDuplicateLabels",
"(",
"ast",
",",
"session",
")",
"{",
"let",
"check",
";",
"function",
"checkExpressionWithClonedEnv",
"(",
"node",
",",
"env",
")",
"{",
"check",
"(",
"node",
".",
"expression",
",",
"util",
".",
"clone",
"(",
"env",
"... | Checks that each label is defined only once within each scope. | [
"Checks",
"that",
"each",
"label",
"is",
"defined",
"only",
"once",
"within",
"each",
"scope",
"."
] | 30f32600084d8da6a50b801edad49619e53e2a05 | https://github.com/pegjs/pegjs/blob/30f32600084d8da6a50b801edad49619e53e2a05/packages/pegjs/lib/compiler/passes/report-duplicate-labels.js#L7-L68 | train |
pegjs/pegjs | packages/pegjs/lib/util/vm.js | evalModule | 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 | 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 );
... | [
"function",
"evalModule",
"(",
"source",
",",
"context",
")",
"{",
"const",
"argumentKeys",
"=",
"Object",
".",
"keys",
"(",
"context",
")",
";",
"const",
"argumentValues",
"=",
"argumentKeys",
".",
"map",
"(",
"argument",
"=>",
"context",
"[",
"argument",
... | `eval` the given source as a CommonJS module, using properties found in `context` as top-level variables.
Based on `vm.runInContext` found in Node.js, this is a cross-env solution. | [
"eval",
"the",
"given",
"source",
"as",
"a",
"CommonJS",
"module",
"using",
"properties",
"found",
"in",
"context",
"as",
"top",
"-",
"level",
"variables",
"."
] | 30f32600084d8da6a50b801edad49619e53e2a05 | https://github.com/pegjs/pegjs/blob/30f32600084d8da6a50b801edad49619e53e2a05/packages/pegjs/lib/util/vm.js#L8-L21 | train |
pegjs/pegjs | packages/pegjs/lib/parser.js | createNode | 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 | function createNode( type, details ) {
const node = new ast.Node( type, location() );
if ( details === null ) return node;
util.extend( node, details );
return util.enforceFastProperties( node );
} | [
"function",
"createNode",
"(",
"type",
",",
"details",
")",
"{",
"const",
"node",
"=",
"new",
"ast",
".",
"Node",
"(",
"type",
",",
"location",
"(",
")",
")",
";",
"if",
"(",
"details",
"===",
"null",
")",
"return",
"node",
";",
"util",
".",
"exten... | Helper to construct a new AST Node | [
"Helper",
"to",
"construct",
"a",
"new",
"AST",
"Node"
] | 30f32600084d8da6a50b801edad49619e53e2a05 | https://github.com/pegjs/pegjs/blob/30f32600084d8da6a50b801edad49619e53e2a05/packages/pegjs/lib/parser.js#L3424-L3432 | train |
pegjs/pegjs | packages/pegjs/lib/parser.js | addComment | function addComment( text, multiline ) {
if ( options.extractComments ) {
const loc = location();
comments[ loc.start.offset ] = {
text: text,
multiline: multiline,
location: loc,
};
}
retu... | javascript | function addComment( text, multiline ) {
if ( options.extractComments ) {
const loc = location();
comments[ loc.start.offset ] = {
text: text,
multiline: multiline,
location: loc,
};
}
retu... | [
"function",
"addComment",
"(",
"text",
",",
"multiline",
")",
"{",
"if",
"(",
"options",
".",
"extractComments",
")",
"{",
"const",
"loc",
"=",
"location",
"(",
")",
";",
"comments",
"[",
"loc",
".",
"start",
".",
"offset",
"]",
"=",
"{",
"text",
":"... | Helper that collects all the comments to pass to the Grammar AST | [
"Helper",
"that",
"collects",
"all",
"the",
"comments",
"to",
"pass",
"to",
"the",
"Grammar",
"AST"
] | 30f32600084d8da6a50b801edad49619e53e2a05 | https://github.com/pegjs/pegjs/blob/30f32600084d8da6a50b801edad49619e53e2a05/packages/pegjs/lib/parser.js#L3438-L3454 | train |
pegjs/pegjs | packages/pegjs/lib/compiler/passes/report-duplicate-rules.js | reportDuplicateRules | 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 | 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(
... | [
"function",
"reportDuplicateRules",
"(",
"ast",
",",
"session",
")",
"{",
"const",
"rules",
"=",
"{",
"}",
";",
"const",
"check",
"=",
"session",
".",
"buildVisitor",
"(",
"{",
"rule",
"(",
"node",
")",
"{",
"const",
"name",
"=",
"node",
".",
"name",
... | Checks that each rule is defined only once. | [
"Checks",
"that",
"each",
"rule",
"is",
"defined",
"only",
"once",
"."
] | 30f32600084d8da6a50b801edad49619e53e2a05 | https://github.com/pegjs/pegjs/blob/30f32600084d8da6a50b801edad49619e53e2a05/packages/pegjs/lib/compiler/passes/report-duplicate-rules.js#L6-L33 | train |
pegjs/pegjs | packages/pegjs/lib/compiler/passes/report-unused-rules.js | reportUnusedRules | 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 | 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 ] ... | [
"function",
"reportUnusedRules",
"(",
"ast",
",",
"session",
",",
"options",
")",
"{",
"const",
"used",
"=",
"{",
"}",
";",
"function",
"yes",
"(",
"node",
")",
"{",
"used",
"[",
"node",
".",
"name",
"||",
"node",
"]",
"=",
"true",
";",
"}",
"optio... | Checks that all rules are used. | [
"Checks",
"that",
"all",
"rules",
"are",
"used",
"."
] | 30f32600084d8da6a50b801edad49619e53e2a05 | https://github.com/pegjs/pegjs/blob/30f32600084d8da6a50b801edad49619e53e2a05/packages/pegjs/lib/compiler/passes/report-unused-rules.js#L4-L29 | train |
theturtle32/WebSocket-Node | lib/browser.js | W3CWebSocket | 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 | 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... | [
"function",
"W3CWebSocket",
"(",
"uri",
",",
"protocols",
")",
"{",
"var",
"native_instance",
";",
"if",
"(",
"protocols",
")",
"{",
"native_instance",
"=",
"new",
"NativeWebSocket",
"(",
"uri",
",",
"protocols",
")",
";",
"}",
"else",
"{",
"native_instance"... | Expose a W3C WebSocket class with just one or two arguments. | [
"Expose",
"a",
"W3C",
"WebSocket",
"class",
"with",
"just",
"one",
"or",
"two",
"arguments",
"."
] | e109ba6b2c4d2bcf4b0f4c0aa7a60855a3cf0c12 | https://github.com/theturtle32/WebSocket-Node/blob/e109ba6b2c4d2bcf4b0f4c0aa7a60855a3cf0c12/lib/browser.js#L9-L27 | train |
theturtle32/WebSocket-Node | lib/WebSocketFrame.js | WebSocketFrame | 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 | 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;
... | [
"function",
"WebSocketFrame",
"(",
"maskBytes",
",",
"frameHeader",
",",
"config",
")",
"{",
"this",
".",
"maskBytes",
"=",
"maskBytes",
";",
"this",
".",
"frameHeader",
"=",
"frameHeader",
";",
"this",
".",
"config",
"=",
"config",
";",
"this",
".",
"maxR... | WebSocketConnection will pass shared buffer objects for maskBytes and frameHeader into the constructor to avoid tons of small memory allocations for each frame we have to parse. This is only used for parsing frames we receive off the wire. | [
"WebSocketConnection",
"will",
"pass",
"shared",
"buffer",
"objects",
"for",
"maskBytes",
"and",
"frameHeader",
"into",
"the",
"constructor",
"to",
"avoid",
"tons",
"of",
"small",
"memory",
"allocations",
"for",
"each",
"frame",
"we",
"have",
"to",
"parse",
".",... | e109ba6b2c4d2bcf4b0f4c0aa7a60855a3cf0c12 | https://github.com/theturtle32/WebSocket-Node/blob/e109ba6b2c4d2bcf4b0f4c0aa7a60855a3cf0c12/lib/WebSocketFrame.js#L31-L41 | train |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | function() {
var EPS = 0.000001;
this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );
return this;
} | javascript | function() {
var EPS = 0.000001;
this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );
return this;
} | [
"function",
"(",
")",
"{",
"var",
"EPS",
"=",
"0.000001",
";",
"this",
".",
"phi",
"=",
"Math",
".",
"max",
"(",
"EPS",
",",
"Math",
".",
"min",
"(",
"Math",
".",
"PI",
"-",
"EPS",
",",
"this",
".",
"phi",
")",
")",
";",
"return",
"this",
";"... | restrict phi to be betwee EPS and PI-EPS | [
"restrict",
"phi",
"to",
"be",
"betwee",
"EPS",
"and",
"PI",
"-",
"EPS"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L6926-L6933 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | extractFromCache | function extractFromCache ( cache ) {
var values = [];
for ( var key in cache ) {
var data = cache[ key ];
delete data.metadata;
values.push( data );
}
return values;
} | javascript | function extractFromCache ( cache ) {
var values = [];
for ( var key in cache ) {
var data = cache[ key ];
delete data.metadata;
values.push( data );
}
return values;
} | [
"function",
"extractFromCache",
"(",
"cache",
")",
"{",
"var",
"values",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"cache",
")",
"{",
"var",
"data",
"=",
"cache",
"[",
"key",
"]",
";",
"delete",
"data",
".",
"metadata",
";",
"values",
"."... | extract data from the cache hash remove metadata on each item and return as array | [
"extract",
"data",
"from",
"the",
"cache",
"hash",
"remove",
"metadata",
"on",
"each",
"item",
"and",
"return",
"as",
"array"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L9101-L9113 | train |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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; ... | [
"function",
"(",
")",
"{",
"var",
"actions",
"=",
"this",
".",
"_actions",
",",
"nActions",
"=",
"this",
".",
"_nActiveActions",
",",
"bindings",
"=",
"this",
".",
"_bindings",
",",
"nBindings",
"=",
"this",
".",
"_nActiveBindings",
";",
"this",
".",
"_n... | deactivates all previously scheduled actions | [
"deactivates",
"all",
"previously",
"scheduled",
"actions"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L13630-L13654 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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... | [
"function",
"(",
"clip",
")",
"{",
"var",
"actions",
"=",
"this",
".",
"_actions",
",",
"clipUuid",
"=",
"clip",
".",
"uuid",
",",
"actionsByClip",
"=",
"this",
".",
"_actionsByClip",
",",
"actionsForClip",
"=",
"actionsByClip",
"[",
"clipUuid",
"]",
";",
... | free all resources specific to a particular clip | [
"free",
"all",
"resources",
"specific",
"to",
"a",
"particular",
"clip"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L13706-L13745 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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... | [
"function",
"(",
"root",
")",
"{",
"var",
"rootUuid",
"=",
"root",
".",
"uuid",
",",
"actionsByClip",
"=",
"this",
".",
"_actionsByClip",
";",
"for",
"(",
"var",
"clipUuid",
"in",
"actionsByClip",
")",
"{",
"var",
"actionByRoot",
"=",
"actionsByClip",
"[",... | free all resources specific to a particular root target object | [
"free",
"all",
"resources",
"specific",
"to",
"a",
"particular",
"root",
"target",
"object"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L13748-L13782 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | function( clip, optionalRoot ) {
var action = this.existingAction( clip, optionalRoot );
if ( action !== null ) {
this._deactivateAction( action );
this._removeInactiveAction( action );
}
} | javascript | function( clip, optionalRoot ) {
var action = this.existingAction( clip, optionalRoot );
if ( action !== null ) {
this._deactivateAction( action );
this._removeInactiveAction( action );
}
} | [
"function",
"(",
"clip",
",",
"optionalRoot",
")",
"{",
"var",
"action",
"=",
"this",
".",
"existingAction",
"(",
"clip",
",",
"optionalRoot",
")",
";",
"if",
"(",
"action",
"!==",
"null",
")",
"{",
"this",
".",
"_deactivateAction",
"(",
"action",
")",
... | remove a targeted clip from the cache | [
"remove",
"a",
"targeted",
"clip",
"from",
"the",
"cache"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L13785-L13796 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | function( binding, rootUuid, trackName ) {
var bindingsByRoot = this._bindingsByRootAndName,
bindingByName = bindingsByRoot[ rootUuid ],
bindings = this._bindings;
if ( bindingByName === undefined ) {
bindingByName = {};
bindingsByRoot[ rootUuid ] = bindingByName;
}
bindingByName[ trackName ] ... | javascript | function( binding, rootUuid, trackName ) {
var bindingsByRoot = this._bindingsByRootAndName,
bindingByName = bindingsByRoot[ rootUuid ],
bindings = this._bindings;
if ( bindingByName === undefined ) {
bindingByName = {};
bindingsByRoot[ rootUuid ] = bindingByName;
}
bindingByName[ trackName ] ... | [
"function",
"(",
"binding",
",",
"rootUuid",
",",
"trackName",
")",
"{",
"var",
"bindingsByRoot",
"=",
"this",
".",
"_bindingsByRootAndName",
",",
"bindingByName",
"=",
"bindingsByRoot",
"[",
"rootUuid",
"]",
",",
"bindings",
"=",
"this",
".",
"_bindings",
";"... | Memory management for PropertyMixer objects | [
"Memory",
"management",
"for",
"PropertyMixer",
"objects"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14140-L14159 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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.... | [
"function",
"(",
")",
"{",
"var",
"interpolants",
"=",
"this",
".",
"_controlInterpolants",
",",
"lastActiveIndex",
"=",
"this",
".",
"_nActiveControlInterpolants",
"++",
",",
"interpolant",
"=",
"interpolants",
"[",
"lastActiveIndex",
"]",
";",
"if",
"(",
"inte... | Memory management of Interpolants for weight and time scale | [
"Memory",
"management",
"of",
"Interpolants",
"for",
"weight",
"and",
"time",
"scale"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14226-L14245 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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 ]... | [
"function",
"(",
"var_args",
")",
"{",
"var",
"objects",
"=",
"this",
".",
"_objects",
",",
"nObjects",
"=",
"objects",
".",
"length",
",",
"nCachedObjects",
"=",
"this",
".",
"nCachedObjects_",
",",
"indicesByUUID",
"=",
"this",
".",
"_indicesByUUID",
",",
... | remove & forget | [
"remove",
"&",
"forget"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14483-L14564 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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... | [
"function",
"(",
"array",
",",
"type",
",",
"forceClone",
")",
"{",
"if",
"(",
"!",
"array",
"||",
"// let 'undefined' and 'null' pass",
"!",
"forceClone",
"&&",
"array",
".",
"constructor",
"===",
"type",
")",
"return",
"array",
";",
"if",
"(",
"typeof",
... | converts an array to a specific type | [
"converts",
"an",
"array",
"to",
"a",
"specific",
"type"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14665-L14678 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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;
} | [
"function",
"(",
"times",
")",
"{",
"function",
"compareTime",
"(",
"i",
",",
"j",
")",
"{",
"return",
"times",
"[",
"i",
"]",
"-",
"times",
"[",
"j",
"]",
";",
"}",
"var",
"n",
"=",
"times",
".",
"length",
";",
"var",
"result",
"=",
"new",
"Ar... | returns an array by which times and values can be sorted | [
"returns",
"an",
"array",
"by",
"which",
"times",
"and",
"values",
"can",
"be",
"sorted"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14688-L14704 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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 + ... | [
"function",
"(",
"values",
",",
"stride",
",",
"order",
")",
"{",
"var",
"nValues",
"=",
"values",
".",
"length",
";",
"var",
"result",
"=",
"new",
"values",
".",
"constructor",
"(",
"nValues",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"dstO... | uses the array previously returned by 'getKeyframeOrder' to sort data | [
"uses",
"the",
"array",
"previously",
"returned",
"by",
"getKeyframeOrder",
"to",
"sort",
"data"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14707-L14726 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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... | [
"function",
"(",
"jsonKeys",
",",
"times",
",",
"values",
",",
"valuePropertyName",
")",
"{",
"var",
"i",
"=",
"1",
",",
"key",
"=",
"jsonKeys",
"[",
"0",
"]",
";",
"while",
"(",
"key",
"!==",
"undefined",
"&&",
"key",
"[",
"valuePropertyName",
"]",
... | function for parsing AOS keyframe formats | [
"function",
"for",
"parsing",
"AOS",
"keyframe",
"formats"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14729-L14799 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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;
} | [
"function",
"(",
"timeOffset",
")",
"{",
"if",
"(",
"timeOffset",
"!==",
"0.0",
")",
"{",
"var",
"times",
"=",
"this",
".",
"times",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"n",
"=",
"times",
".",
"length",
";",
"i",
"!==",
"n",
";",
"++",
... | move all keyframes either forwards or backwards in time | [
"move",
"all",
"keyframes",
"either",
"forwards",
"or",
"backwards",
"in",
"time"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14949-L14965 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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 !== ... | [
"function",
"(",
")",
"{",
"var",
"binding",
"=",
"this",
".",
"binding",
";",
"var",
"buffer",
"=",
"this",
".",
"buffer",
",",
"stride",
"=",
"this",
".",
"valueSize",
",",
"originalValueOffset",
"=",
"stride",
"*",
"3",
";",
"binding",
".",
"getValu... | remember the state of the bound property and copy it to both accus | [
"remember",
"the",
"state",
"of",
"the",
"bound",
"property",
"and",
"copy",
"it",
"to",
"both",
"accus"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L16092-L16112 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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();
} | [
"function",
"(",
"focalLength",
")",
"{",
"// see http://www.bobatkins.com/photography/technical/field_of_view.html",
"var",
"vExtentSlope",
"=",
"0.5",
"*",
"this",
".",
"getFilmHeight",
"(",
")",
"/",
"focalLength",
";",
"this",
".",
"fov",
"=",
"THREE",
".",
"Mat... | Sets the FOV by focal length in respect to the current .filmGauge.
The default film gauge is 35, so that the focal length can be specified for
a 35mm (full frame) camera.
Values for focal length and film gauge must have the same unit. | [
"Sets",
"the",
"FOV",
"by",
"focal",
"length",
"in",
"respect",
"to",
"the",
"current",
".",
"filmGauge",
"."
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L17279-L17287 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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;
} | [
"function",
"(",
"t",
",",
"p0",
",",
"p1",
",",
"p2",
",",
"p3",
")",
"{",
"return",
"-",
"3",
"*",
"p0",
"*",
"(",
"1",
"-",
"t",
")",
"*",
"(",
"1",
"-",
"t",
")",
"+",
"3",
"*",
"p1",
"*",
"(",
"1",
"-",
"t",
")",
"*",
"(",
"1",... | Puay Bing, thanks for helping with this derivative! | [
"Puay",
"Bing",
"thanks",
"for",
"helping",
"with",
"this",
"derivative!"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L33808-L33815 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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;
} | [
"function",
"(",
"contour",
")",
"{",
"var",
"n",
"=",
"contour",
".",
"length",
";",
"var",
"a",
"=",
"0.0",
";",
"for",
"(",
"var",
"p",
"=",
"n",
"-",
"1",
",",
"q",
"=",
"0",
";",
"q",
"<",
"n",
";",
"p",
"=",
"q",
"++",
")",
"{",
"... | calculate area of the contour polygon | [
"calculate",
"area",
"of",
"the",
"contour",
"polygon"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L33897-L33910 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | 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 | 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();
} | [
"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",
"... | Returns a unit vector tangent at t In case any sub curve does not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation | [
"Returns",
"a",
"unit",
"vector",
"tangent",
"at",
"t",
"In",
"case",
"any",
"sub",
"curve",
"does",
"not",
"implement",
"its",
"tangent",
"derivation",
"2",
"points",
"a",
"small",
"delta",
"apart",
"will",
"be",
"used",
"to",
"find",
"its",
"gradient",
... | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L34881-L34898 | train | |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | calculatePositionOnCurve | 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 | 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.... | [
"function",
"calculatePositionOnCurve",
"(",
"u",
",",
"p",
",",
"q",
",",
"radius",
",",
"position",
")",
"{",
"var",
"cu",
"=",
"Math",
".",
"cos",
"(",
"u",
")",
";",
"var",
"su",
"=",
"Math",
".",
"sin",
"(",
"u",
")",
";",
"var",
"quOverP",
... | this function calculates the current position on the torus curve | [
"this",
"function",
"calculates",
"the",
"current",
"position",
"on",
"the",
"torus",
"curve"
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L39290-L39301 | train |
AlloyTeam/AlloyTouch | example/threejs/asset/three.js | subdivide | 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 | 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 ++... | [
"function",
"subdivide",
"(",
"face",
",",
"detail",
")",
"{",
"var",
"cols",
"=",
"Math",
".",
"pow",
"(",
"2",
",",
"detail",
")",
";",
"var",
"a",
"=",
"prepare",
"(",
"that",
".",
"vertices",
"[",
"face",
".",
"a",
"]",
")",
";",
"var",
"b"... | Analytically subdivide a face to the required detail level. | [
"Analytically",
"subdivide",
"a",
"face",
"to",
"the",
"required",
"detail",
"level",
"."
] | 4f93a9232a817bd2bfdcc67b46748dc423a2f3ed | https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L39786-L39850 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.