{"id":18946625,"url":"https://github.com/baues/building-editor-react","last_synced_at":"2026-01-23T11:43:30.527Z","repository":{"id":57146543,"uuid":"361043876","full_name":"baues/building-editor-react","owner":"baues","description":"React wrapper for building-editor","archived":false,"fork":false,"pushed_at":"2022-05-28T06:33:38.000Z","size":133,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-21T14:39:15.647Z","etag":null,"topics":["bim","building-editor","react","threejs","webgl"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/baues.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-24T01:24:12.000Z","updated_at":"2022-08-10T03:01:25.000Z","dependencies_parsed_at":"2022-09-06T13:02:15.185Z","dependency_job_id":null,"html_url":"https://github.com/baues/building-editor-react","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baues%2Fbuilding-editor-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baues%2Fbuilding-editor-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baues%2Fbuilding-editor-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baues%2Fbuilding-editor-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baues","download_url":"https://codeload.github.com/baues/building-editor-react/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586830,"owners_count":21129111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bim","building-editor","react","threejs","webgl"],"created_at":"2024-11-08T13:07:27.609Z","updated_at":"2026-01-23T11:43:30.500Z","avatar_url":"https://github.com/baues.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# building-editor-react\n\n[![npm version](https://badge.fury.io/js/building-editor-react.svg)](https://badge.fury.io/js/building-editor-react)\n\nReact wrapper for [building-editor](https://github.com/baues/building-editor)\n\n## Installation\n\n```\nnpm install building-editor-react\n```\n\n## Usage\n\n[Sample code](https://codesandbox.io/s/sad-https-ms8ob)\n\nAt any parent component\n```js\nimport { Provider } from 'building-editor-react';\n\nfunction MyEditorParent() {\n  return (\n    \u003cProvider\u003e\n      Your children\n    \u003c/Provider\u003e\n  );\n}\n```\n\nAt any child component\n```js\nimport { Editor, ViewCube, useEvents } from 'building-editor-react';\nimport MyMenu from './MyMenu'; // your menu component described below\n\nfunction MyEditor() {\n  useEvents(); // if you need\n\n  return (\n    \u003c\u003e\n      \u003cEditor contextMenu={\u003cMyMenu /\u003e} /\u003e\n      \u003cViewCube style={{ position: 'absolute', zIndex: 1, left: 50, bottom: 50 }} /\u003e\n    \u003c/\u003e\n  );\n}\n```\n\n## API\n\n### Editor\n\nEditor component to make your editor. It takes `config` and `contextMenu` props.\n\n### Provider\n\nEditor context provider component which must be placed parent component of Editor.\n\n### ContextMenu, ContextMenuItem, useContextMenuClose\n\nCreate your custom context menu component as below.\n\n```js\nimport { ContextMenu, ContextMenuItem, useContextMenuClose } from 'building-editor-react';\n\nfunction MyMenu() {\n  const closeContextMenu = useContextMenuClose();\n\n  return (\n    \u003cContextMenu\n      onClose={closeContextMenu}\n    \u003e\n      \u003cContextMenuItem\u003eYour Menu\u003c/ContextMenuItem\u003e\n      \u003cContextMenuItem\u003eYour Menu2\u003c/ContextMenuItem\u003e\n    \u003c/ContextMenu\u003e\n  );\n}\n```\n\n### ViewCube\n\nBuilt-in ViewCube component. It's not able to be customized for now.\n\n### useEditor, useEditorState\n\nEditor instance of `building-editor` is accessible from this hooks. You can get whole editor instance with useEditor while curated properties are available with useEditorState.\n\n```js\nconst { editor, setEditor } = useEditor();\nconst { renderer, scene, sceneHelpers, viewportCamera, raycaster, selected, hovered, gridHelper, axesHelper, planeHelper, stencilPlane } = useEditorState();\n\n```\n\n### useActions\n\nMany actions are available from this hooks. Check [here](https://github.com/baues/building-editor-react/blob/main/src/hooks/useActions.ts) to use them.  \nFollowings are the actions available from hooks  \n- render:()-\u003evoid  \n- setScreenSize  \n- select  \n- setHovered  \n- focus  \n- addGeometry  \n- addMaterialToRefCounter  \n- addMaterial  \n- getObjectMaterial  \n- setObjectMaterial  \n- addCamera  \n- addObject  \n- removeObject  \n- addObjectAsHelper  \n- clipGlobal  \n- setTransformControlsMode  \n- updateGridHelper  \n- updateAxesHelper  \n- loadFile  \n- loadFiles  \n- loadFileFromLocal  \n- loadFilesFromLocal  \n- exportObject  \n- exportScene  \n- exportDAE  \n- clearEditor  \n\n### useEvents\n\nThis is built-in handler of `building-editor` events. It's not necessary to use this, but you can easily create editor behavior with `useEvent`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaues%2Fbuilding-editor-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaues%2Fbuilding-editor-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaues%2Fbuilding-editor-react/lists"}