From 7920d63d681b8337cb55e1e06f7f4fd4c438aee4 Mon Sep 17 00:00:00 2001 From: QuadFlask Date: Tue, 22 Oct 2019 17:10:11 +0900 Subject: [PATCH] =?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=A0=95=EC=9D=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80,=20=EB=B2=84=EC=A0=84=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.d.ts | 32 ++++++++++++++++++++++++++------ index.js | 19 +++++++++++++++++-- index.tsx | 31 ++++++++++++++++++++++++++++++- package.json | 2 +- 4 files changed, 74 insertions(+), 10 deletions(-) diff --git a/index.d.ts b/index.d.ts index 514f0c69..7efc81c2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -26,6 +26,26 @@ export declare const LayerGroup: { LAYER_GROUP_CADASTRAL: string; LAYER_GROUP_MOUNTAIN: string; }; +export declare enum Gravity { + NO_GRAVITY = 0, + AXIS_SPECIFIED = 1, + AXIS_PULL_BEFORE = 2, + AXIS_PULL_AFTER = 4, + AXIS_X_SHIFT = 0, + AXIS_Y_SHIFT = 4, + TOP = 48, + BOTTOM = 80, + LEFT = 3, + RIGHT = 5, + CENTER_VERTICAL = 16, + CENTER_HORIZONTAL = 1 +} +export interface Rect { + left?: number; + top?: number; + right?: number; + bottom?: number; +} export interface NaverMapViewProps { style?: StyleProp; center?: Coord & { @@ -35,12 +55,9 @@ export interface NaverMapViewProps { }; tilt?: number; bearing?: number; - mapPadding?: { - left: number; - top: number; - right: number; - bottom: number; - }; + mapPadding?: Rect; + logoMargin?: Rect; + logoGravity?: Gravity; onInitialized?: Function; onCameraChange?: (event: { latitude: number; @@ -127,6 +144,9 @@ interface CircleProps { coordinate: Coord; radius?: number; color?: string; + outlineWidth?: number; + outlineColor?: string; + zIndex?: number; } export declare class Circle extends Component { render(): JSX.Element; diff --git a/index.js b/index.js index 739ee9f2..f1b4c36b 100644 --- a/index.js +++ b/index.js @@ -26,6 +26,21 @@ export const LayerGroup = { LAYER_GROUP_CADASTRAL: 'landparcel', LAYER_GROUP_MOUNTAIN: 'mountain', }; +export var Gravity; +(function (Gravity) { + Gravity[Gravity["NO_GRAVITY"] = 0] = "NO_GRAVITY"; + Gravity[Gravity["AXIS_SPECIFIED"] = 1] = "AXIS_SPECIFIED"; + Gravity[Gravity["AXIS_PULL_BEFORE"] = 2] = "AXIS_PULL_BEFORE"; + Gravity[Gravity["AXIS_PULL_AFTER"] = 4] = "AXIS_PULL_AFTER"; + Gravity[Gravity["AXIS_X_SHIFT"] = 0] = "AXIS_X_SHIFT"; + Gravity[Gravity["AXIS_Y_SHIFT"] = 4] = "AXIS_Y_SHIFT"; + Gravity[Gravity["TOP"] = 48] = "TOP"; + Gravity[Gravity["BOTTOM"] = 80] = "BOTTOM"; + Gravity[Gravity["LEFT"] = 3] = "LEFT"; + Gravity[Gravity["RIGHT"] = 5] = "RIGHT"; + Gravity[Gravity["CENTER_VERTICAL"] = 16] = "CENTER_VERTICAL"; + Gravity[Gravity["CENTER_HORIZONTAL"] = 1] = "CENTER_HORIZONTAL"; +})(Gravity || (Gravity = {})); export default class NaverMapView extends Component { constructor() { super(...arguments); @@ -61,8 +76,8 @@ export default class NaverMapView extends Component { this.handleOnMapClick = (event) => this.props.onMapClick && this.props.onMapClick(event.nativeEvent); } render() { - const { onInitialized, center, tilt, bearing, mapPadding, nightMode, } = this.props; - return React.createElement(RNNaverMapView, Object.assign({ ref: this.resolveRef }, this.props, { onInitialized: onInitialized, center: center, mapPadding: mapPadding, tilt: tilt, bearing: bearing, nightMode: nightMode, onCameraChange: this.handleOnCameraChange, onMapClick: this.handleOnMapClick })); + const { onInitialized, center, tilt, bearing, mapPadding, logoMargin, nightMode, } = this.props; + return React.createElement(RNNaverMapView, Object.assign({ ref: this.resolveRef }, this.props, { onInitialized: onInitialized, center: center, mapPadding: mapPadding, logoMargin: logoMargin, tilt: tilt, bearing: bearing, nightMode: nightMode, onCameraChange: this.handleOnCameraChange, onMapClick: this.handleOnMapClick })); } } export class Marker extends Component { diff --git a/index.tsx b/index.tsx index 4d7624d4..cc83c931 100644 --- a/index.tsx +++ b/index.tsx @@ -36,12 +36,36 @@ export const LayerGroup = { LAYER_GROUP_MOUNTAIN: 'mountain', }; +export enum Gravity { + NO_GRAVITY = 0x0000, + AXIS_SPECIFIED = 0x0001, + AXIS_PULL_BEFORE = 0x0002, + AXIS_PULL_AFTER = 0x0004, + AXIS_X_SHIFT = 0, + AXIS_Y_SHIFT = 4, + TOP = (AXIS_PULL_BEFORE | AXIS_SPECIFIED) << AXIS_Y_SHIFT, + BOTTOM = (AXIS_PULL_AFTER | AXIS_SPECIFIED) << AXIS_Y_SHIFT, + LEFT = (AXIS_PULL_BEFORE | AXIS_SPECIFIED) << AXIS_X_SHIFT, + RIGHT = (AXIS_PULL_AFTER | AXIS_SPECIFIED) << AXIS_X_SHIFT, + CENTER_VERTICAL = AXIS_SPECIFIED << AXIS_Y_SHIFT, + CENTER_HORIZONTAL = AXIS_SPECIFIED << AXIS_X_SHIFT, +} + +export interface Rect { + left?: number + top?: number + right?: number + bottom?: number +} + export interface NaverMapViewProps { style?: StyleProp; center?: Coord & { zoom?: number; tilt?: number; bearing?: number }; tilt?: number; bearing?: number; - mapPadding?: { left: number; top: number; right: number; bottom: number }; + mapPadding?: Rect; + logoMargin?: Rect; + logoGravity?: Gravity; onInitialized?: Function; onCameraChange?: (event: { latitude: number; @@ -127,6 +151,7 @@ export default class NaverMapView extends Component { tilt, bearing, mapPadding, + logoMargin, nightMode, } = this.props; @@ -136,6 +161,7 @@ export default class NaverMapView extends Component { onInitialized={onInitialized} center={center} mapPadding={mapPadding} + logoMargin={logoMargin} tilt={tilt} bearing={bearing} nightMode={nightMode} @@ -185,6 +211,9 @@ interface CircleProps { coordinate: Coord; radius?: number; color?: string; + outlineWidth?: number + outlineColor?: string + zIndex?: number } export class Circle extends Component { diff --git a/package.json b/package.json index 93c204a7..70c9e4a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-nmap", - "version": "0.0.36", + "version": "0.0.37", "description": "react-native bridge for naver map", "main": "index.js", "author": "QuadFlask",