2.5.18 • Published 17 hours ago

hart-estate-widget v2.5.18

Weekly downloads
-
License
-
Repository
-
Last release
17 hours ago

HART Estate Widget Component

Prerequisites

node: 16.13.1

Installation using NPM:

npm install hart-estate-widget --save

Usage example:

HTML

<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
    <title>katmosfera</title>
    <link rel="icon" href="./assets/img/logo.png">
    <script src="./js/index.js" type="module"></script>
  </head>

  <body>
    <section class="widget-section">
      <div class="widget" id="widget"></div> <!--must match the first attribute in 'new Widget('#widget', options);' --> 
    </section>
  </body>
</html>

JS

import { ApiStore, Widget, rotationModes } from 'hart-estate-widget';
import '../assets/sass/index.sass'; // style
import logo from '../assets/img/logo.png'; // logo

const WIDGET_API_URL = 'https://backend.estate.hart-digital.com';

const createWidget = async (logoUrl) => {
  const widgetApiHandler = new ApiStore(WIDGET_API_URL)

  const { searchParams } = new URL(document.location);
  const planId = searchParams.get("id");

  const planData = await widgetApiHandler.loadWidgetData(planId);
  const options = { // the parameters you need
    ...planData.parsed,
    API_URL: WIDGET_API_URL,
    rotationMode: rotationModes.DEFAULT,
    tabs: ['panorama', 'rotation'],
    locale: 'en',
    logoUrl,
    logo,
  }

  new Widget('#widget', options); // must match the element id
}

createWidget('https://yoursite/'); // create a widget

Functionality check:

Instalization

  1. npm install sass@1.62.1
  2. npm install parcel@2.8.3
  3. npm install @parcel/transformer-sass@2.8.3

Add files

  1. add index.html to the ~/src/index.html using the above described content for HTML
  2. add index.js to the ~/src/js/index.js using the above described content for JS
  3. add logo.png to the ~/src/assets/img/logo.png (if the logo is not png then replace all paths to the logo)
  4. add index.sass to the ~/src/assets/sass/index.sass using:
*, *:before, *:after
  -webkit-font-smoothing: antialiased
  -moz-osx-font-smoothing: grayscale
  font-family: 'Proxima Nova'
  text-decoration: none
  font-weight: 400
  color: #fff
  outline: none
  padding: 0
  margin: 0
  box-sizing: border-box
  -webkit-box-sizing: border-box

body
  width: 100%
  height: 100%
  overflow: hidden

.widget-section
  width: 100%
  height: 100%
  .widget
    width: 100%
    height: 100%

Run

  1. rm -rf dist && npx parcel ./src/index.html
  2. open: http://localhost:1234/?id=4c834af9-e08a-4ede-bd53-b231bcae38da

Parameters:

{
  // elements  
  tabs: ['rotation', 'panorama'], // included elements

  // logo
  logo: '', // path to logo
  logoUrl: '', // link opened when logo is clicked

  // localization
  locale: 'en', // ISO 639 language code

  // width/height
  width: 1920,
  height: 1080,
  resizable: true, // automatically resize the widget to the size of the container when the window is resized

  // values
  rotationMode: 'default', // mode of operation for plan images
  panoramaFov: 75, // camera field of view angle for panoramic tour
  enableCameraTransitionBetweenPanoramas: true, // enable / disable camera rotation transition between panoramas (if CameraPoint.Rotation.Yaw is defined in json)
  primaryCameraPointId: null, // primary camera point id for panorama tour
  floors: [ // array of floors, contains 360° images and panoramic tour data
    {
      original_plan_img: '',  // path to the original plan image (required for panoramic tour)
      styled_plan_img: '',  // path to the styled plan image (required for panoramic tour)
      top_view_img: '',  // path to the top view image
      panorama: '',  // type of panorama and paths to 360° images
      rotate: '',  // type of images and paths to circular view images (order is mandatory)
    }
  ],

  // colors
  colors: {
    main: '#HEX', // main color of buttons, elements
    mainText: '#HEX', // text color for buttons, elements contrasting with the main color
  },

  // panorama icons
  panoramaIcons: {
    spot: 'URL', // icon for camera points in one room
    door: 'URL' // icon for door
  },
}

Types of elements

tabs: [
  'rotation', // circular view images (order is mandatory)
  'panorama', // 360° images
],
rotationMode: [
  rotationModes.DEFAULT, // top view mode (multiple perspectives) and stylized plan view
  rotationModes.THREESIXTY, // image scrolling mode for circular view
],
floors[0].rotate.type: [
  'top_down', // full model
  'middle_cut', // model with cut in the middle
],
floors[0].panorama.type: [
  'sphere', // 360° panorama
  'cube', // panorama with 6 images (top, down, left, right, front, back)
],
locale: [
  'ru', // Russian language
  'en', // English language
],
2.5.18

17 hours ago

2.5.15

5 days ago

2.5.14

11 days ago

2.4.12

13 days ago

2.4.9

1 month ago

2.3.6

3 months ago

2.3.5

3 months ago

2.4.7

2 months ago

2.3.7

3 months ago

2.3.4

3 months ago

2.1.2

4 months ago

2.1.3

4 months ago

2.0.5

4 months ago

2.0.6

4 months ago

2.1.1

4 months ago

2.0.3

4 months ago

2.0.4

4 months ago

1.1.6

5 months ago

1.1.5

5 months ago

1.1.4

5 months ago

1.1.3

5 months ago

0.0.105

11 months ago

0.0.104

11 months ago

0.0.103

11 months ago

0.0.102

11 months ago

0.0.101

12 months ago

0.0.100

12 months ago

0.0.96

1 year ago

0.0.97

1 year ago

0.0.98

1 year ago

0.0.99

12 months ago

0.0.89

1 year ago

0.0.95

1 year ago

0.0.90

1 year ago

0.0.91

1 year ago

0.0.92

1 year ago

0.0.93

1 year ago

0.0.94

1 year ago

0.0.88

1 year ago

0.0.84

2 years ago

0.0.85

2 years ago

0.0.86

1 year ago

0.0.87

1 year ago

0.0.83

2 years ago

0.0.80

2 years ago

0.0.81

2 years ago

0.0.79

2 years ago

0.0.77

2 years ago

0.0.78

2 years ago

0.0.40

2 years ago

0.0.41

2 years ago

0.0.42

2 years ago

0.0.43

2 years ago

0.0.44

2 years ago

0.0.45

2 years ago

0.0.46

2 years ago

0.0.47

2 years ago

0.0.37

2 years ago

0.0.38

2 years ago

0.0.39

2 years ago

0.0.73

2 years ago

0.0.74

2 years ago

0.0.75

2 years ago

0.0.76

2 years ago

0.0.33

2 years ago

0.0.34

2 years ago

0.0.35

2 years ago

0.0.36

2 years ago

0.0.70

2 years ago

0.0.71

2 years ago

0.0.72

2 years ago

0.0.62

2 years ago

0.0.63

2 years ago

0.0.64

2 years ago

0.0.65

2 years ago

0.0.66

2 years ago

0.0.67

2 years ago

0.0.68

2 years ago

0.0.69

2 years ago

0.0.60

2 years ago

0.0.61

2 years ago

0.0.59

2 years ago

0.0.51

2 years ago

0.0.52

2 years ago

0.0.53

2 years ago

0.0.54

2 years ago

0.0.55

2 years ago

0.0.56

2 years ago

0.0.57

2 years ago

0.0.58

2 years ago

0.0.50

2 years ago

0.0.48

2 years ago

0.0.49

2 years ago

0.0.30

2 years ago

0.0.31

2 years ago

0.0.32

2 years ago

0.0.25

2 years ago

0.0.26

2 years ago

0.0.27

2 years ago

0.0.28

2 years ago

0.0.29

2 years ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago