diff --git a/CHANGELOG.md b/CHANGELOG.md index a8b914826cc..4ef821991c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## master + +#### Deprecation Notices +- [Style classes](https://www.mapbox.com/mapbox-gl-style-spec/#layer-paint.*) are deprecated and will be removed in an upcoming release of Mapbox GL JS. + ## 0.31.0 (Jan 10 2017) #### New Features diff --git a/js/ui/map.js b/js/ui/map.js index 93bddd9c491..8c6e049bd5a 100755 --- a/js/ui/map.js +++ b/js/ui/map.js @@ -256,12 +256,15 @@ class Map extends Camera { * in an HTML element's `class` attribute. To learn more about Mapbox style classes, read about * [Layers](https://www.mapbox.com/mapbox-gl-style-spec/#layers) in the style specification. * + * **Note:** Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS. + * * @param {string} klass The style class to add. * @param {StyleOptions} [options] * @fires change * @returns {Map} `this` */ addClass(klass, options) { + util.warnOnce('Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS.'); if (this._classes.indexOf(klass) >= 0 || klass === '') return this; this._classes.push(klass); this._classOptions = options; @@ -273,12 +276,15 @@ class Map extends Camera { /** * Removes a Mapbox style class from the map. * + * **Note:** Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS. + * * @param {string} klass The style class to remove. * @param {StyleOptions} [options] * @fires change * @returns {Map} `this` */ removeClass(klass, options) { + util.warnOnce('Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS.'); const i = this._classes.indexOf(klass); if (i < 0 || klass === '') return this; this._classes.splice(i, 1); @@ -291,12 +297,15 @@ class Map extends Camera { /** * Replaces the map's existing Mapbox style classes with a new array of classes. * + * **Note:** Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS. + * * @param {Array} klasses The style classes to set. * @param {StyleOptions} [options] * @fires change * @returns {Map} `this` */ setClasses(klasses, options) { + util.warnOnce('Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS.'); const uniqueClasses = {}; for (let i = 0; i < klasses.length; i++) { if (klasses[i] !== '') uniqueClasses[klasses[i]] = true; @@ -312,19 +321,25 @@ class Map extends Camera { * Returns a Boolean indicating whether the map has the * specified Mapbox style class. * + * **Note:** Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS. + * * @param {string} klass The style class to test. * @returns {boolean} `true` if the map has the specified style class. */ hasClass(klass) { + util.warnOnce('Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS.'); return this._classes.indexOf(klass) >= 0; } /** * Returns the map's Mapbox style classes. * + * **Note:** Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS. + * * @returns {Array} The map's style classes. */ getClasses() { + util.warnOnce('Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS.'); return this._classes; }