Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create Geolocation widget #6

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
22926fc
feat: init for starter
airslice Aug 8, 2022
2382d30
clean: remove starter package
airslice Aug 8, 2022
5e9d622
refactor: update readme
airslice Aug 8, 2022
77dd10a
feat: include dist plugin in repo
airslice Aug 8, 2022
f6cfd48
feat: add auto update package.json
airslice Aug 9, 2022
90f98e1
feat: add devlopment deps
airslice Aug 9, 2022
92d6183
feat: add export icon
airslice Aug 9, 2022
79c66f5
style: update icon size
airslice Aug 9, 2022
80e34c2
feat: empty info support children
airslice Aug 9, 2022
88ea755
fix: type
airslice Aug 9, 2022
845765e
fix: display err
airslice Aug 9, 2022
91a4d68
feat: enable cdn import
airslice Aug 10, 2022
3098787
chore: add pkg dev deps
airslice Aug 12, 2022
621836f
feat: support plugin specific svg icons
airslice Aug 12, 2022
327e692
feat: update title size
airslice Aug 12, 2022
5aa4868
feat: add Line support for center
airslice Aug 12, 2022
cce3821
style: remove min-height of emptyInfo
airslice Sep 12, 2022
3f5da81
chore: add alias for src
airslice Sep 13, 2022
67baef3
feat: add common utils
airslice Sep 13, 2022
db10534
refactor: update codes
airslice Sep 13, 2022
63fb7e4
feat: add theme pt.1
airslice Sep 14, 2022
82a8ff7
feat: add optional icon to button
airslice Sep 14, 2022
42315c0
feat: update starter for theme
airslice Sep 14, 2022
05c8eb9
style: decrease icon margin
airslice Sep 14, 2022
72d21d5
refactor: update global style
airslice Sep 14, 2022
81936fd
chore: add lodash
airslice Sep 14, 2022
5495ae2
feat: update theme
airslice Sep 14, 2022
1f69230
style: update style
airslice Sep 14, 2022
73ae53e
style: align button icon
airslice Sep 14, 2022
342f61a
feat: disable hover on mobile
airslice Sep 15, 2022
9173280
feat: update components with theme
airslice Sep 15, 2022
e70a2ee
refactor: remove unused property
airslice Sep 15, 2022
ad4e517
refactor: update property group
airslice Sep 15, 2022
ab7cce6
fix: customize undefined
airslice Sep 15, 2022
99c474e
style: multiple style update
airslice Sep 16, 2022
6d6cfa6
style: update text area
airslice Sep 16, 2022
9a1502b
style: add width for button
airslice Sep 16, 2022
ed468ae
refactor: update filelist
airslice Sep 16, 2022
6c3d28a
style: update UI
airslice Sep 21, 2022
fc7e13f
style: add position to Line
airslice Oct 21, 2022
714f68d
feat: add property style
airslice Oct 21, 2022
7e6aba3
style: update header size to 44
airslice Nov 14, 2022
3225ae3
feat:create geolocation widget
Dec 1, 2022
a99fece
geo
Dec 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ node_modules

/.idea/

/dist
/dist/web
78 changes: 1 addition & 77 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,4 @@
# reearth-plugin-toolbox

## Overview

This is a reearth plugin project, structure refrenced from https://github.com/eukarya-inc/reearth-plateauview.

## Install

- Download the zip file at https://github.com/airslice/reearth-plugin-toolbox/tree/main/package
- Install it in your Re:earth project.

## Toolbox - Starter

- Just a simple starter to show some UI elements.

## Toolbox - Tag Cloud

Tag Cloud will be helpful when you want to organize layer data in ONE dimension.

![test reearth dev_published html_alias=chiafhhehd(1440 desktop)](https://user-images.githubusercontent.com/21994748/182887355-a26709cc-d3db-4f47-86ac-c04c021b9207.png)

- Features:
- Show a certain tag group as tag cloud.
- Show/hide layers by tags.

- Setup:
- Input the tag group name from Re:earth Earth Editor.

- Tips:
- Layer will be visible when any of its tag is enabled.
- If a layer does not have any tags of selected tag group it will be list in a special tag `...`

## Toolbox - Tag Filter

Tag filter can be useful when show layers with tags in different dimensions.

![test reearth dev_published html_alias=idchebgbdb(1440 desktop) (1)](https://user-images.githubusercontent.com/21994748/183280643-7f183826-d48a-4faa-a5f6-93089ca91867.png)

- Features:
- Show several tag filter base on selected tag groups.
- Each filter can be enable/disabled independently.
- Filter layers (show/hide).

- Setup:
- Add/remove/reorder tag group from Re:earth Earth Editor.
- Type in the tag group name.

- Tips:
- Layer will be visible when it has enabled tag in each enabled filter.
- If a layer does not have any tags of selected tag group it will be list in a special tag `...`


## Toolbox - Measure Distance

A tool to measure distance.

![test reearth dev_published html_alias=jgdaegajfd(1440 desktop)](https://user-images.githubusercontent.com/21994748/183281314-8f3bf7d9-a488-49e1-b740-7dab7c67767d.png)

- Features:
- Measure distance on earth surface.
- Support segmentation.
- Support switch unit between kilometers and miles.

- Setup:
- Point color & line color can be customized from Re:earth Earth Editor.

- Tips:
- Right click can also finish current measurement.
- For some reason render the line on TEST ENV needs some time but on PROD should be okey.

## Known issue & Suggestions

- Sometimes on published (and preview) page marker renders without an update.
- Build with cdn import is disabled now.
- Plugin API needs a event of layers data change.
- Plugin will want to get noticed when layers data changed to update itself. Currently can only use on update which is triggered too often.
- Plugin API needs to expose the actual visibility.
- The layer visibility is not avaliable from plugin API (only show/hide method supported) so the plugin mantains status internally which is not convenient and will lead to some mistakes between multiple plugins who controls the visibility.
- Plugin API needs to support fix camera.
- Sometimes plugin may want to drag something on earth; Either provide an API to fix camera or support DnD on dynamic added layers is enough. The first way seems simpler.
- Just a simple starter to show some UI elements.
Binary file added dist/plugin.zip
Binary file not shown.
21 changes: 21 additions & 0 deletions dist/plugin/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 lby

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 4 additions & 0 deletions dist/plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# reearth-plugin-toolbox
## Toolbox - Starter

- Just a simple starter to show some UI elements.
281 changes: 281 additions & 0 deletions dist/plugin/geolocation.js

Large diffs are not rendered by default.

140 changes: 140 additions & 0 deletions dist/plugin/reearth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: Toolbox Starter
version: 0.1.0
id: reearth-plugin-toolbox-starter
extensions:
- id: Geolocation
type: widget
name: Geolocation
widgetLayout:
defaultLocation:
zone: outer
section: left
area: top
schema:
groups:
- id: location
title: My Location
representativeField: mode
fields:
- id: mode
title: Mode
type: string
list: true
defaultValue: button
choices:
- key: button
label: Button
- key: ui
label: UI
- id: autoFollow
title: Auto Follow
type: bool
defaultValue: false
availableIf:
field: mode
type: string
value: button
- id: markerStyle
title: Marker Style
representativeField: style
fields:
- id: style
type: string
title: Style
list: true
defaultValue: point
choices:
- key: point
label: Point
- key: icon
label: Icon
- key: Model
label: 3D model
- id: pointColor
type: string
title: Point color
ui: color
availableIf:
field: style
type: string
value: point
- id: pointSize
type: number
title: Point size
suffix: px
availableIf:
field: style
type: string
value: point
- id: outlineColor
type: string
title: Point outline color
ui: color
availableIf:
field: style
type: string
value: point
- id: outlineWidth
type: number
title: Point outline width
suffix: px
availableIf:
field: style
type: string
value: point
- id: imageUrl
title: Image URL
type: url
ui: image
availableIf:
field: style
type: string
value: icon
- id: imageSize
title: size
type: number
availableIf:
field: style
type: string
value: icon
- id: modelUrl
title: 3D Model
type: url
ui: file
availableIf:
field: style
type: string
value: Model
- id: modelSize
title: size
type: number
availableIf:
field: style
type: string
value: Model
- id: modelHeading
title: Heading
type: number
availableIf:
field: style
type: string
value: Model
- id: customize
title: Customize
fields:
- id: theme
type: string
title: Theme
choices:
- key: dark
label: Dark
- key: light
label: Light
- id: backgroundColor
type: string
title: Background Color
ui: color
- id: primaryColor
type: string
title: Primary Color
ui: color
22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,11 @@
},
"scripts": {
"start:starter": "vite -c vite.config.starter-web.ts",
"start:tagcloud": "vite -c vite.config.tagcloud-web.ts",
"start:tagfilter": "vite -c vite.config.tagfilter-web.ts",
"start:distance": "vite -c vite.config.distance-web.ts",
"build": "run-s typecheck clean build:web build:plugin",
"build:plugin": "run-s build:starter build:tagcloud build:tagfilter build:distance",
"build:web": "run-s build:starter-web build:tagcloud-web build:tagfilter-web build:distance-web",
"build:plugin": "run-s build:geolocation",
"build:web": "run-s build:geolocation-web",
"build:starter": "vite build -c vite.config.starter.ts",
"build:starter-web": "vite build -c vite.config.starter-web.ts",
"build:tagcloud": "vite build -c vite.config.tagcloud.ts",
"build:tagcloud-web": "vite build -c vite.config.tagcloud-web.ts",
"build:tagfilter": "vite build -c vite.config.tagfilter.ts",
"build:tagfilter-web": "vite build -c vite.config.tagfilter-web.ts",
"build:distance": "vite build -c vite.config.distance.ts",
"build:distance-web": "vite build -c vite.config.distance-web.ts",
"package": "run-s build zip",
"typecheck": "tsc",
"test": "vitest",
Expand All @@ -33,7 +24,10 @@
"type": "tsc",
"zip": "node ./scripts/zip.mjs",
"createwidget": "node ./scripts/createwidget.mjs",
"clean": "del dist"
"clean": "del dist",
"start:geolocation": "vite -c vite.config.geolocation-web.ts",
"build:geolocation": "vite build -c vite.config.geolocation.ts",
"build:geolocation-web": "vite build -c vite.config.geolocation-web.ts"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.4",
Expand All @@ -57,6 +51,7 @@
"eslint-plugin-testing-library": "^5.5.1",
"jsdom": "^19.0.0",
"json-to-pretty-yaml": "^1.2.2",
"load-pkg": "^4.0.0",
"msw": "^0.41.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2",
Expand All @@ -65,9 +60,11 @@
"typescript": "^4.7.2",
"vite": "^2.9.9",
"vite-plugin-cdn-import": "^0.3.5",
"vite-plugin-externals": "^0.5.1",
"vite-plugin-singlefile": "^0.9.0",
"vite-plugin-svgr": "^2.2.1",
"vitest": "^0.12.9",
"write-pkg": "^5.1.0",
"yml": "^1.0.0"
},
"msw": {
Expand All @@ -77,6 +74,7 @@
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
"@turf/turf": "^6.5.0",
"@types/lodash": "^4.14.185",
"mini-svg-data-uri": "^1.4.4",
"react-inlinesvg": "^3.0.0"
}
Expand Down
Binary file removed package/reearth-plugin-toolbox-0.1.4.zip
Binary file not shown.
Binary file added package/reearth-plugin-toolbox-starter-0.1.0.zip
Binary file not shown.
Loading