From b6bd35c15c0763148c039da075972fc3733dc75f Mon Sep 17 00:00:00 2001 From: ahocevar Date: Sun, 14 Jul 2019 10:15:00 +0200 Subject: [PATCH] Fix observable properties documentation --- config/jsdoc/api/plugins/api.js | 20 +++++++++++++++++++- src/ol/View.js | 2 -- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/config/jsdoc/api/plugins/api.js b/config/jsdoc/api/plugins/api.js index fae15e465b..866b04064a 100644 --- a/config/jsdoc/api/plugins/api.js +++ b/config/jsdoc/api/plugins/api.js @@ -31,6 +31,24 @@ function hasApiMembers(doclet) { } function includeAugments(doclet) { + // Make sure that `observables` and `fires` are taken from an already processed `class` doclet. + // This is necessary because JSDoc generates multiple doclets with the same longname. + const cls = classes[doclet.longname]; + if (cls.observables && !doclet.observables) { + doclet.observables = cls.observables; + } + if (doclet.fires && cls.fires) { + for (let i = 0, ii = cls.fires.length; i < ii; ++i) { + const fires = cls.fires[i]; + if (doclet.fires.indexOf(fires) == -1) { + doclet.fires.push(fires); + } + } + } + if (cls.fires && !doclet.fires) { + doclet.fires = cls.fires; + } + const augments = doclet.augments; if (augments) { let cls; @@ -148,7 +166,7 @@ exports.handlers = { // constructor from the docs. doclet._hideConstructor = true; includeAugments(doclet); - } else if (doclet.undocumented !== false && !doclet._hideConstructor && !(doclet.kind == 'typedef' && doclet.longname in types)) { + } else if (!doclet._hideConstructor && !(doclet.kind == 'typedef' && doclet.longname in types)) { // Remove all other undocumented symbols doclet.undocumented = true; } diff --git a/src/ol/View.js b/src/ol/View.js index 4d500c2e6a..253371cc78 100644 --- a/src/ol/View.js +++ b/src/ol/View.js @@ -1147,7 +1147,6 @@ class View extends BaseObject { * constraint will apply. * @param {number} ratio The ratio to apply on the view resolution. * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation. - * @observable * @api */ adjustResolution(ratio, opt_anchor) { @@ -1179,7 +1178,6 @@ class View extends BaseObject { * constraint will apply. * @param {number} delta Relative value to add to the zoom rotation, in radians. * @param {import("./coordinate.js").Coordinate=} opt_anchor The rotation center. - * @observable * @api */ adjustRotation(delta, opt_anchor) {