-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Josh-ES/circle
Circle Component
- Loading branch information
Showing
41 changed files
with
79,369 additions
and
61,793 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"plugins": ["transform-es2015-instanceof"], | ||
"presets": ["es2015"], | ||
"sourceMaps": "inline" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import HEREMap, { Circle } from "../../src/main"; | ||
import * as React from "react"; | ||
|
||
export default class CircleMap extends React.Component<any, any> { | ||
public static subtitle = "This example shows you how to create an interactive map" + | ||
" centred in London, England, with a circle of radius 1km displayed over the top of it."; | ||
|
||
public static title = "Circle Map"; | ||
|
||
public static code = "import React, { Component } from \"react\";\n" + | ||
"import HEREMap from \"react-here-maps\";\n" + | ||
"\n" + | ||
"export default class Map extends Component {\n" + | ||
" render() {\n" + | ||
" // center the map somewhere in London\n" + | ||
" const center = {\n" + | ||
" lat: 51.5,\n" + | ||
" lng: 0,\n" + | ||
" };\n" + | ||
" \n" + | ||
" return (\n" + | ||
" <HEREMap\n" + | ||
" appId={your_app_id}\n" + | ||
" appCode={your_app_code}\n" + | ||
" center={center}\n" + | ||
" zoom={8}\n" + | ||
" hidpi={true}\n" + | ||
" >\n" + | ||
" <Circle\n" + | ||
" {...center}\n" + | ||
" strokeColor=\"#1275E8\"\n" + | ||
" fillColor=\"rgba(212, 92, 91, 0.2)\"\n" + | ||
" lineWidth={2}\n" + | ||
" radius={10000}\n" + | ||
" />\n" + | ||
" </HEREMap>\n" + | ||
" )\n" + | ||
" }\n" + | ||
"}\n"; | ||
|
||
public render() { | ||
// center the map somewhere in London | ||
const center = { | ||
lat: 51.5, | ||
lng: 0, | ||
}; | ||
|
||
return ( | ||
<HEREMap | ||
center={center} | ||
zoom={8} | ||
hidpi={true} | ||
secure={true} | ||
appId="NoiW7CS2CC05ppu95hyL" | ||
appCode="28L997fKdiJiY7TVVEsEGQ" | ||
> | ||
<Circle | ||
{...center} | ||
strokeColor="#1275E8" | ||
fillColor="rgba(18, 117, 232, 0.2)" | ||
lineWidth={2} | ||
radius={10000} | ||
/> | ||
</HEREMap> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
import HEREMap, { Circle } from "../../src/main"; | ||
import * as React from "react"; | ||
|
||
interface MovableCircleMapProps { | ||
|
||
} | ||
|
||
interface MovableCircleMapState { | ||
center: H.geo.IPoint; | ||
radius: number; | ||
} | ||
|
||
export default class MovableCircleMap extends React.Component<MovableCircleMapProps, MovableCircleMapState> { | ||
public static subtitle = "This example shows you how to create an interactive map" + | ||
" centred in London, England, with a circle of radius 1km displayed over the top of it." + | ||
" The circle's position can be toggled between two possible locations by clicking a " + | ||
"provided button, and toggled between two possible radii with another."; | ||
|
||
public static title = "Movable and Resizable Circle Map"; | ||
|
||
public static code = "import React, { Component } from \"react\";\n" + | ||
"import HEREMap from \"react-here-maps\";\n" + | ||
"\n" + | ||
"export default class Map extends Component {\n" + | ||
" render() {\n" + | ||
" // center the map somewhere in London\n" + | ||
" const center = {\n" + | ||
" lat: 51.5,\n" + | ||
" lng: 0,\n" + | ||
" };\n" + | ||
" \n" + | ||
" return (\n" + | ||
" <div>\n" + | ||
" <HEREMap\n" + | ||
" appId={your_app_id}\n" + | ||
" appCode={your_app_code}\n" + | ||
" center={center}\n" + | ||
" zoom={8}\n" + | ||
" hidpi={true}\n" + | ||
" >\n" + | ||
" <Circle\n" + | ||
" {...center}\n" + | ||
" strokeColor=\"#1275E8\"\n" + | ||
" fillColor=\"rgba(212, 92, 91, 0.2)\"\n" + | ||
" lineWidth={2}\n" + | ||
" radius={10000}\n" + | ||
" />\n" + | ||
" </HEREMap>\n" + | ||
" \n" + | ||
" <button>\n" + | ||
" Change Position\n" + | ||
" </button>\n" + | ||
" \n" + | ||
" <button>\n" + | ||
" Change Radius\n" + | ||
" </button>\n" + | ||
" </div>\n" + | ||
" )\n" + | ||
" }\n" + | ||
"}\n"; | ||
|
||
public state: MovableCircleMapState = { | ||
center: { | ||
lat: 51.5, | ||
lng: 0, | ||
}, | ||
|
||
radius: 10000, | ||
}; | ||
|
||
constructor(props: any, context: any) { | ||
super(props, context); | ||
this.togglePosition = this.togglePosition.bind(this); | ||
this.toggleRadius = this.toggleRadius.bind(this); | ||
} | ||
|
||
public render() { | ||
// center the map somewhere in London | ||
const { | ||
center, | ||
radius, | ||
} = this.state; | ||
|
||
return ( | ||
<div> | ||
<HEREMap | ||
center={center} | ||
zoom={8} | ||
hidpi={true} | ||
secure={true} | ||
appId="NoiW7CS2CC05ppu95hyL" | ||
appCode="28L997fKdiJiY7TVVEsEGQ" | ||
> | ||
<Circle | ||
{...center} | ||
strokeColor="#1275E8" | ||
fillColor="rgba(18, 117, 232, 0.2)" | ||
lineWidth={2} | ||
radius={radius} | ||
/> | ||
</HEREMap> | ||
|
||
<button onClick={this.togglePosition}> | ||
Change Position | ||
</button> | ||
|
||
<button onClick={this.toggleRadius}> | ||
Change Radius | ||
</button> | ||
</div> | ||
); | ||
} | ||
|
||
private togglePosition() { | ||
const { | ||
center, | ||
} = this.state; | ||
|
||
center.lng = center.lng ? 0 : 0.2; | ||
|
||
this.setState({ | ||
center, | ||
} as MovableCircleMapState); | ||
} | ||
|
||
private toggleRadius() { | ||
let { | ||
radius, | ||
} = this.state; | ||
|
||
radius = radius === 10000 ? 5000 : 10000; | ||
|
||
this.setState({ | ||
radius, | ||
} as MovableCircleMapState); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import HEREMap, { Marker } from "../../src/main"; | ||
import * as React from "react"; | ||
|
||
interface MovableMarkerMapProps { | ||
|
||
} | ||
|
||
interface MovableMarkerMapState { | ||
center: H.geo.IPoint; | ||
} | ||
|
||
export default class MovableMarkerMap extends React.Component<MovableMarkerMapProps, MovableMarkerMapState> { | ||
public static subtitle = "This example shows you how to create an interactive map" + | ||
" centred in London, England, with map images displayed in high resolution. " + | ||
"A marker marking the center location is added by passing a Marker component" + | ||
" instance as a child of the HEREMap component. The marker's position can be " + | ||
"toggled between two possible locations by clicking a provided button."; | ||
|
||
public static title = "Movable Marker Map"; | ||
|
||
public static code = "import React, { Component } from \"react\";\n" + | ||
"import HEREMap from \"react-here-maps\";\n" + | ||
"\n" + | ||
"export default class Map extends Component {\n" + | ||
" render() {\n" + | ||
" // center the map somewhere in London\n" + | ||
" const center = {\n" + | ||
" lat: 51.5,\n" + | ||
" lng: 0,\n" + | ||
" };\n" + | ||
" \n" + | ||
" return (\n" + | ||
" <div>\n" + | ||
" <HEREMap\n" + | ||
" appId={your_app_id}\n" + | ||
" appCode={your_app_code}\n" + | ||
" center={center}\n" + | ||
" zoom={8}\n" + | ||
" hidpi={true}\n" + | ||
" >\n" + | ||
" <Marker {...center}>\n" + | ||
" <div class='circle-marker' />\n" + | ||
" </Marker>\n" + | ||
" </HEREMap>\n" + | ||
" \n" + | ||
" <button>\n" + | ||
" Change Position\n" + | ||
" </button>\n" + | ||
" </div>\n" + | ||
" )\n" + | ||
" }\n" + | ||
"}\n"; | ||
|
||
public state: MovableMarkerMapState = { | ||
center: { | ||
lat: 51.5, | ||
lng: 0, | ||
}, | ||
}; | ||
|
||
constructor(props: any, context: any) { | ||
super(props, context); | ||
this.togglePosition = this.togglePosition.bind(this); | ||
} | ||
|
||
public render() { | ||
// center the map somewhere in London | ||
const { | ||
center, | ||
} = this.state; | ||
|
||
return ( | ||
<div> | ||
<HEREMap | ||
center={center} | ||
zoom={8} | ||
hidpi={true} | ||
secure={true} | ||
appId="NoiW7CS2CC05ppu95hyL" | ||
appCode="28L997fKdiJiY7TVVEsEGQ" | ||
> | ||
<Marker {...center}> | ||
<div className="circle-marker" /> | ||
</Marker> | ||
</HEREMap> | ||
|
||
<button onClick={this.togglePosition}> | ||
Change Position | ||
</button> | ||
</div> | ||
); | ||
} | ||
|
||
private togglePosition() { | ||
const { | ||
center, | ||
} = this.state; | ||
|
||
center.lng = center.lng ? 0 : 0.2; | ||
|
||
this.setState({ | ||
center, | ||
} as MovableMarkerMapState); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
button { | ||
background: #1275E8; | ||
border: none; | ||
box-shadow: none; | ||
color: #FFF; | ||
margin-top: 20px; | ||
display: block; | ||
width: 100%; | ||
font-weight: 300; | ||
padding: 20px 0; | ||
font-size: 13px; | ||
|
||
&:focus { | ||
outline: none; | ||
} | ||
} |
Oops, something went wrong.