Skip to content

Commit

Permalink
jsdoc added
Browse files Browse the repository at this point in the history
  • Loading branch information
David Manzanares committed Nov 24, 2017
1 parent 1902105 commit 84dcd28
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
docs/
20 changes: 20 additions & 0 deletions config/jsdoc/internal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"source": {
"include": [
"src"
]
},
"templates": {
"default": {
"outputSourceFiles": false,
"useLongnameInNav": true
}
},
"plugins": [
"plugins/markdown"
],
"opts": {
"recurse": true,
"destination": "./docs/internal"
}
}
26 changes: 26 additions & 0 deletions config/jsdoc/plugins/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Define @api tag
*/
exports.defineTags = function (dictionary) {
dictionary.defineTag('api', {
mustHaveValue: false,
canHaveType: false,
canHaveName: false,
onTagged: function (doclet, tag) {
doclet.public = true;
}
});
};

/*
* Only items with @api annotation should be documented
*/

exports.handlers = {
parseComplete: function (e) {
var doclets = e.doclets;
for (var i = 0; i < doclets.length; i++) {
doclets[i].undocumented = !doclets[i].public;
}
}
};
21 changes: 21 additions & 0 deletions config/jsdoc/public.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"source": {
"include": [
"src"
]
},
"templates": {
"default": {
"outputSourceFiles": false,
"useLongnameInNav": true
}
},
"plugins": [
"plugins/api",
"plugins/markdown"
],
"opts": {
"recurse": true,
"destination": "./docs/public"
}
}
16 changes: 14 additions & 2 deletions dist/gmaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,11 @@ Renderer.prototype.addTile = function (tile) {
return tile;
}

/**
* THIS IS A RENDERER.
* @constructor
* @param {HTMLElement} canvas
*/
function Renderer(canvas) {
this.canvas = canvas;
this.tiles = [];
Expand Down Expand Up @@ -664,14 +669,21 @@ function Renderer(canvas) {
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
}

/**
* Wadus qwuasdfdasfasd fsadfads
* @api Get Renderer center in Renderer coordinates
* @param {fff}
* @name Renderer#getCenter
*/
Renderer.prototype.getCenter = function () {
return { x: this._center.x, y: this._center.y };
}
};

Renderer.prototype.setCenter = function (x, y) {
this._center.x = x;
this._center.y = y;
window.requestAnimationFrame(refresh.bind(this));
}
};

Renderer.prototype.getZoom = function () {
return this._zoom;
Expand Down
16 changes: 14 additions & 2 deletions dist/mapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,11 @@ Renderer.prototype.addTile = function (tile) {
return tile;
}

/**
* THIS IS A RENDERER.
* @constructor
* @param {HTMLElement} canvas
*/
function Renderer(canvas) {
this.canvas = canvas;
this.tiles = [];
Expand Down Expand Up @@ -664,14 +669,21 @@ function Renderer(canvas) {
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
}

/**
* Wadus qwuasdfdasfasd fsadfads
* @api Get Renderer center in Renderer coordinates
* @param {fff}
* @name Renderer#getCenter
*/
Renderer.prototype.getCenter = function () {
return { x: this._center.x, y: this._center.y };
}
};

Renderer.prototype.setCenter = function (x, y) {
this._center.x = x;
this._center.y = y;
window.requestAnimationFrame(refresh.bind(this));
}
};

Renderer.prototype.getZoom = function () {
return this._zoom;
Expand Down
16 changes: 14 additions & 2 deletions dist/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,11 @@ Renderer.prototype.addTile = function (tile) {
return tile;
}

/**
* THIS IS A RENDERER.
* @constructor
* @param {HTMLElement} canvas
*/
function Renderer(canvas) {
this.canvas = canvas;
this.tiles = [];
Expand Down Expand Up @@ -664,14 +669,21 @@ function Renderer(canvas) {
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
}

/**
* Wadus qwuasdfdasfasd fsadfads
* @api Get Renderer center in Renderer coordinates
* @param {fff}
* @name Renderer#getCenter
*/
Renderer.prototype.getCenter = function () {
return { x: this._center.x, y: this._center.y };
}
};

Renderer.prototype.setCenter = function (x, y) {
this._center.x = x;
this._center.y = y;
window.requestAnimationFrame(refresh.bind(this));
}
};

Renderer.prototype.getZoom = function () {
return this._zoom;
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack",
"build:watch": "webpack -w"
"build:watch": "webpack -w",
"build-doc": "rm -rf docs/; node_modules/.bin/jsdoc --configure config/jsdoc/internal.json; node_modules/.bin/jsdoc --configure config/jsdoc/public.json"
},
"repository": {
"type": "git",
Expand All @@ -24,7 +25,8 @@
"dependencies": {
"@mapbox/vector-tile": "^1.3.0",
"cartocolor": "^4.0.0",
"jsdoc": "^3.5.5",
"jsep": "^0.3.2",
"pbf": "^3.1.0"
}
}
}
41 changes: 35 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ var gl;
// they imply a small waste of resources too
const RTT_WIDTH = 1024;

Renderer.prototype._initShaders = function () {
this.finalRendererProgram = shaders.renderer.createPointShader(gl);
}

Renderer.prototype.refresh = refresh;
function refresh(timestamp) {
// Don't re-render more than once per animation frame
Expand Down Expand Up @@ -252,6 +248,13 @@ Renderer.prototype.addTile = function (tile) {
return tile;
}

/**
* THIS IS A RENDERER.
* @api
* @memberOf renderer
* @constructor
* @param {HTMLElement} canvas - adlfkajdsf
*/
function Renderer(canvas) {
this.canvas = canvas;
this.tiles = [];
Expand Down Expand Up @@ -280,14 +283,40 @@ function Renderer(canvas) {
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
}

/**
* Initialize static shaders
*/
Renderer.prototype._initShaders = function () {
this.finalRendererProgram = shaders.renderer.createPointShader(gl);
}


/**
* @api
* @typedef {object} RPoint
* @property {number} x
* @property {number} y
*/

/**
* Get Renderer visualization center
* @api
* @return {RPoint}
*/
Renderer.prototype.getCenter = function () {
return { x: this._center.x, y: this._center.y };
}
};
/**
* Set Renderer visualization center
* @api
* @param {number} x
* @param {number} y
*/
Renderer.prototype.setCenter = function (x, y) {
this._center.x = x;
this._center.y = y;
window.requestAnimationFrame(refresh.bind(this));
}
};

Renderer.prototype.getZoom = function () {
return this._zoom;
Expand Down

0 comments on commit 84dcd28

Please sign in to comment.