-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
180 additions
and
75 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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './Map'; | ||
export * from './Platform'; |
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,23 @@ | ||
import { mapEventTypes, mapEvents } from './defaults'; | ||
|
||
export const initInteraction = ( | ||
map: H.Map, | ||
interactive: boolean, | ||
useEvents: boolean, | ||
events: typeof mapEvents | ||
) => { | ||
let behavior = interactive | ||
? new H.mapevents.Behavior(new H.mapevents.MapEvents(map)) | ||
: null; | ||
if (useEvents && interactive) { | ||
for (const type in events) { | ||
if (events.hasOwnProperty(type)) { | ||
const callback = events[type as mapEventTypes]; | ||
if (callback && typeof callback === 'function') { | ||
map.addEventListener(type, callback); | ||
} | ||
} | ||
} | ||
} | ||
return behavior; | ||
}; |
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,8 @@ | ||
export const initInteractionStyles = () => { | ||
const style = document.createElement('style'); | ||
const css = `.grab = {cursor: move;cursor: grab;cursor: -moz-grab;cursor: -webkit-grab;}.grabbing{cursor:grabbing;cursor:-moz-grabbing;cursor:-webkit-grabbing}`; | ||
style.type = 'text/css'; | ||
style.appendChild(document.createTextNode(css)); | ||
const head = document.head || document.getElementsByTagName('head')[0]; | ||
head.appendChild(style); | ||
}; |
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
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,36 @@ | ||
import React from 'react'; | ||
import { Meta, Story } from '@storybook/react'; | ||
import { HPlatform, IHPlatform } from '../src/'; | ||
const appId = 'EF8K24SYpkpXUO9rkbfA'; | ||
const apiKey = 'TIAGlD6jic7l9Aa8Of8IFxo3EUemmcZlHm_agfAm6Ew'; | ||
const meta: Meta = { | ||
title: 'HPlatform JSX', | ||
component: HPlatform, | ||
args: { | ||
options: { | ||
appId, | ||
apiKey, | ||
includeUI: true, | ||
includePlaces: false, | ||
version: 'v3/3.1', | ||
interactive: true, | ||
}, | ||
children: <>Overriden Children If all went well, yaay! 🙂 </>, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
const Template: Story<IHPlatform> = args => { | ||
return ( | ||
<HPlatform options={args.options}> | ||
{args.children || 'Render Anything'} | ||
</HPlatform> | ||
); | ||
}; | ||
|
||
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test | ||
// https://storybook.js.org/docs/react/workflows/unit-testing | ||
export const Default = Template.bind({}); | ||
|
||
Default.args = {}; |
This file was deleted.
Oops, something went wrong.
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,36 @@ | ||
import React from 'react'; | ||
import { Meta, Story } from '@storybook/react'; | ||
import { HPlatform, IHPlatform, useHPlatform } from '../src'; | ||
import { ILoadHMapOptions } from '../src/components/libs/loadHMap'; | ||
const appId = 'EF8K24SYpkpXUO9rkbfA'; | ||
const apiKey = 'TIAGlD6jic7l9Aa8Of8IFxo3EUemmcZlHm_agfAm6Ew'; | ||
const meta: Meta = { | ||
title: 'useHPlatform', | ||
component: HPlatform, | ||
args: { | ||
options: { | ||
appId, | ||
apiKey, | ||
includeUI: true, | ||
includePlaces: false, | ||
version: 'v3/3.1', | ||
interactive: true, | ||
}, | ||
children: <>Overriden Children If all went well, yaay! 🙂 </>, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
const Template: Story<ILoadHMapOptions> = args => { | ||
return useHPlatform( | ||
{ ...args }, | ||
<>Render Some Children Here, if Platform did load successfully</> | ||
); | ||
}; | ||
|
||
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test | ||
// https://storybook.js.org/docs/react/workflows/unit-testing | ||
export const Default = Template.bind({}); | ||
|
||
Default.args = {}; |
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