From 5a828cb80fb69f88840d3085b79c9e756bf0e66d Mon Sep 17 00:00:00 2001 From: Fredrik Karlsson Date: Mon, 22 Aug 2016 13:59:09 +0200 Subject: [PATCH] [ios, macos] override style spec documentation --- .../darwin/scripts/generate-style-code.js | 3 +- .../scripts/style-spec-overrides-v8.json | 55 +++++++++++++++++++ platform/darwin/src/MGLBackgroundStyleLayer.h | 2 +- platform/darwin/src/MGLCircleStyleLayer.h | 2 +- platform/darwin/src/MGLFillStyleLayer.h | 6 +- platform/darwin/src/MGLLineStyleLayer.h | 4 +- platform/darwin/src/MGLSymbolStyleLayer.h | 14 ++--- 7 files changed, 71 insertions(+), 15 deletions(-) create mode 100644 platform/darwin/scripts/style-spec-overrides-v8.json diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index 62ab3b6b983..80d7504de47 100644 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -2,8 +2,9 @@ const fs = require('fs'); const ejs = require('ejs'); -const spec = require('mapbox-gl-style-spec').latest; +const _ = require('lodash'); const colorParser = require('csscolorparser'); +const spec = _.merge(require('mapbox-gl-style-spec').latest, require('./style-spec-overrides-v8.json')); const prefix = 'MGL'; const suffix = 'StyleLayer'; diff --git a/platform/darwin/scripts/style-spec-overrides-v8.json b/platform/darwin/scripts/style-spec-overrides-v8.json new file mode 100644 index 00000000000..ed429351389 --- /dev/null +++ b/platform/darwin/scripts/style-spec-overrides-v8.json @@ -0,0 +1,55 @@ +{ + "layout_symbol": { + "icon-text-fit-padding": { + "doc": "Size of the additional area added to dimensions determined by `icon-text-fit`." + }, + "icon-offset": { + "doc": "Offset distance of icon from its anchor." + }, + "text-offset": { + "doc": "Offset distance of text from its anchor." + }, + "text-transform": { + "doc": "Specifies how to capitalize text." + } + }, + "paint_background": { + "background-pattern": { + "doc": "Name of image in style images to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)." + } + }, + "paint_fill": { + "fill-pattern": { + "doc": "Name of image in style images to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)." + } + }, + "paint_line": { + "line-pattern": { + "doc": "Name of image in style images to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512)." + }, + "line-translate": { + "doc": "The geometry's offset." + } + }, + "paint_circle": { + "circle-translate": { + "doc": "The geometry's offset." + } + }, + "paint_fill": { + "fill-translate": { + "doc": "The geometry's offset." + }, + "fill-color": { + "doc": "The color of the filled part of this layer." + } + }, + "paint_symbol": { + "icon-translate": { + "doc": "Distance that the icon's anchor is moved from its original placement." + }, + "text-translate": { + "doc": "Distance that the text's anchor is moved from its original placement." + } + } +} \ No newline at end of file diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.h b/platform/darwin/src/MGLBackgroundStyleLayer.h index 1c167fc91c6..a70383cc9ca 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.h +++ b/platform/darwin/src/MGLBackgroundStyleLayer.h @@ -39,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN #endif /** - Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). + Name of image in style images to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). */ @property (nonatomic, null_resettable) MGLStyleValue *backgroundPattern; diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h index 6006250cdf0..da7076e7d19 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.h +++ b/platform/darwin/src/MGLCircleStyleLayer.h @@ -88,7 +88,7 @@ typedef NS_ENUM(NSUInteger, MGLCirclePitchScale) { @property (nonatomic, null_resettable) MGLStyleValue *circleOpacity; /** - The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. + The geometry's offset. This property is measured in points. diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h index 712bfea9980..799fa380c04 100644 --- a/platform/darwin/src/MGLFillStyleLayer.h +++ b/platform/darwin/src/MGLFillStyleLayer.h @@ -48,7 +48,7 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslateAnchor) { #if TARGET_OS_IPHONE /** - The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1pt stroke, if it is used. + The color of the filled part of this layer. The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. @@ -57,7 +57,7 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslateAnchor) { @property (nonatomic, null_resettable) MGLStyleValue *fillColor; #else /** - The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1pt stroke, if it is used. + The color of the filled part of this layer. The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. @@ -74,7 +74,7 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslateAnchor) { @property (nonatomic, null_resettable) MGLStyleValue *fillOutlineColor; /** - The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. + The geometry's offset. This property is measured in points. diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index 663e9277182..68b0a73a2ea 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -134,7 +134,7 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { #endif /** - The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. + The geometry's offset. This property is measured in points. @@ -197,7 +197,7 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { @property (nonatomic, null_resettable) MGLStyleValue *> *lineDasharray; /** - Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512). + Name of image in style images to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512). */ @property (nonatomic, null_resettable) MGLStyleValue *linePattern; diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h index 9bd943a34ed..dc0cd236c8f 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.h +++ b/platform/darwin/src/MGLSymbolStyleLayer.h @@ -171,7 +171,7 @@ typedef NS_ENUM(NSUInteger, MGLTextAnchor) { }; /** - Specifies how to capitalize text, similar to the CSS `text-transform` property. + Specifies how to capitalize text. Values of this type are used in the `textTransform` property of `MGLSymbolStyleLayer`. */ @@ -312,7 +312,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { @property (nonatomic, null_resettable) MGLStyleValue *iconTextFit; /** - Size of the additional area added to dimensions determined by `iconTextFit`, in clockwise order: top, right, bottom, left. + Size of the additional area added to dimensions determined by `iconTextFit`. This property is measured in points. @@ -359,7 +359,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { @property (nonatomic, null_resettable) MGLStyleValue *iconKeepUpright; /** - Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. + Offset distance of icon from its anchor. The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 from the left and 0 from the top. Set this property to `nil` to reset it to the default value. @@ -506,7 +506,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { @property (nonatomic, null_resettable) MGLStyleValue *textKeepUpright; /** - Specifies how to capitalize text, similar to the CSS `text-transform` property. + Specifies how to capitalize text. The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextTransformNone`. Set this property to `nil` to reset it to the default value. @@ -515,7 +515,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { @property (nonatomic, null_resettable) MGLStyleValue *textTransform; /** - Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up. + Offset distance of text from its anchor. This property is measured in ems. @@ -626,7 +626,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { @property (nonatomic, null_resettable) MGLStyleValue *iconHaloBlur; /** - Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up. + Distance that the icon's anchor is moved from its original placement. This property is measured in points. @@ -717,7 +717,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { @property (nonatomic, null_resettable) MGLStyleValue *textHaloBlur; /** - Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up. + Distance that the text's anchor is moved from its original placement. This property is measured in points.