Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adactive/adsum-wayfindingcontrols-asia

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adactive/adsum-wayfindingcontrols-asia - npm Package Compare versions

Comparing version 2.5.1 to 2.5.3

5

CHANGELOG.md
1.0.0 - Create a Way Finding Controls Component
1.0.1 - Fixing Bug
1.0.2 - Fixing Bug
1.0.3 - Fixing Bug
1.0.4 - Fixing Bug
- Add Arrival and Destination Label Style Props

4

package.json
{
"name": "@adactive/adsum-wayfindingcontrols-asia",
"version": "2.5.1",
"version": "2.5.3",
"description": "Adsum Way Finding Controls Component",

@@ -40,3 +40,3 @@ "main": "index.js",

],
"gitHead": "e37f46629f661fdf2d2f4b26e66efcb4a2fc7a2d"
"gitHead": "5a7de0b34b71a7589e5e6e4161d2a82b7b0a3482"
}

@@ -130,6 +130,12 @@ # Carousel component

**This WayFinding Have FOUR OPTIONAL PROPS**
1. destinationLabelText, it is Destination Label Text, the default was "You Reached (Shop)"
2. icLabelText, it is InterChange Label Text, the default was "Head Down/Up (Floor)"
3. arrivalLabelStyle, it is Destination Label Styling and Offset, the structure should be the same as the default which can see below (props Detail)
4. interchangeLabelStyle, it is Interchange Label Styling and Offset, the structure should be the same as the default which can see below (props Detail)
# Props Detail
```javascript
type OwnPropsType = {|
type OwnPropsType = {|
//props needed when call this component

@@ -141,2 +147,4 @@ awm: *,

icLabelText: string,
arrivalLabelStyle: object,
interchangeLabelStyle: object,
|};

@@ -147,2 +155,30 @@

icLabelText: "Head ",
arrivalLabelStyle: {
offset: {
x: 0,
y: 0,
z: 15,
},
style: {
backgroundColor: '#00437a',
backgroundOpacity: 0.9,
backgroundRadius: 3,
color: '#ffffff',
size: 4,
},
},
interchangeLabelStyle: {
offset: {
x: 0,
y: 0,
z: 15,
},
style: {
backgroundColor: '#00437a',
backgroundOpacity: 0.9,
backgroundRadius: 3,
color: '#ffffff',
size: 4,
},
},
}

@@ -149,0 +185,0 @@ ```

@@ -9,3 +9,3 @@ // @flow

import { MainActions, WayfindingActions, SelectionActions } from '@adactive/arc-map';
import { WayFindingControlsActions } from '..';
import { WayFindingControlsActions } from '../';

@@ -19,2 +19,6 @@ type MappedStatePropsType = {|

type MappedDispatchPropsType = {|
setPercentage: (percentage: ?number) => void,
resetMap: (animated: boolean) => void,
changeFloor: (floorId: number) => void,
takeMeThere: (poi: *) => void,
destination: (poi: *) => void,

@@ -25,7 +29,8 @@ placeDestination: (poiPlace: *) => void,

resetInterchangeLabel: () => void,
resetArrivalLabel: () => void,
resetMapAndWayFinding: (
reset: ?boolean,
resetMap: ?boolean,
resetMapAnimatedOption: ?boolean,
resetWayfinding: ?boolean)
reset : ?boolean,
resetMap: ?boolean,
resetMapAnimatedOption: ?boolean,
resetWayfinding: ?boolean)
=> void,

@@ -38,41 +43,71 @@ resetMap: (animated: boolean) => void,

type OwnPropsType = {|
// props needed when call this component
//props needed when call this component
awm: *,
kioskPlace: object,
// optional props
//optional props
destinationLabelText: string,
icLabelText: string,
arrivalLabelStyle: object,
interchangeLabelStyle: object,
|};
type PropsType = MappedStatePropsType & MappedDispatchPropsType & OwnPropsType;
class WayFindingControls extends React.Component<PropsType, StateType> {
class WayFindingControls extends React.Component<PropsType, StateType> {
static defaultProps = {
destinationLabelText: 'You reached ',
icLabelText: 'Head ',
destinationLabelText: "You reached ",
icLabelText: "Head ",
arrivalLabelStyle: {
offset: {
x: 0,
y: 0,
z: 15,
},
style: {
backgroundColor: '#00437a',
backgroundOpacity: 0.9,
backgroundRadius: 3,
color: '#ffffff',
size: 4,
},
},
interchangeLabelStyle: {
offset: {
x: 0,
y: 0,
z: 15,
},
style: {
backgroundColor: '#00437a',
backgroundOpacity: 0.9,
backgroundRadius: 3,
color: '#ffffff',
size: 4,
},
},
}
componentDidUpdate(prevProps) {
const {
kioskPlace,
wayfindingState,
wayFindingControlsState,
getPath,
destination,
placeDestination,
destinationLabelText,
icLabelText,
resetMapAndWayFinding,
resetMap,
resetSelection,
onRemovePath
} = this.props;
componentDidUpdate(prevProps){
const { kioskPlace,
wayfindingState,
wayFindingControlsState,
getPath,
destination,
placeDestination,
destinationLabelText,
icLabelText,
resetMapAndWayFinding,
resetMap,
resetSelection,
onRemovePath,
} = this.props;
// While Drawing
// While Drawing
if (wayfindingState.drawing
&& wayFindingControlsState.takeMeThere
if(!wayfindingState.drawing
&& prevProps.wayfindingState.drawing
&& wayFindingControlsState.takeMeThere
&& wayFindingControlsState.takeMeThere[0]
&& wayFindingControlsState.takeMeThere[0].id) {
// Define Needed Variable
&& wayFindingControlsState.takeMeThere[0].id){
// Define Needed Variable

@@ -84,53 +119,57 @@ const path = getPath(wayFindingControlsState.takeMeThere[0].id);

const finalLabelText = destinationLabelText + poiDestination[0].name;
// Store Destination Poi and Destination Place
// Store Destination Poi and Destination Place
if(wayFindingControlsState.destination !== poiDestination
&& wayFindingControlsState.placeDestination !== destinationFloor){
destination(poiDestination);
placeDestination(destinationFloor);
}
// If The Current Index Of Wayfinder is Even (Between Add Interchange(IC) Label or Add Destination Label)
if (wayfindingState.currentSectionIndex % 2 === 0){
if (wayFindingControlsState.destination !== poiDestination
&& wayFindingControlsState.placeDestination !== destinationFloor) {
destination(poiDestination);
placeDestination(destinationFloor);
}
// If The Current Index Of Wayfinder is Even (Between Add Interchange(IC) Label or Add Destination Label)
if (wayfindingState.currentSectionIndex % 2 === 0) {
// If Interchange Label Exist, Delete it
if (wayFindingControlsState.interchangeLabel.length > 0) {
// If Interchange Label Exist, Delete it
if(wayFindingControlsState.interchangeLabel.length>0){
this.deleteInterchangeLabel();
}
// If It is Destination Label
if (prevProps.wayfindingState.drawing !== wayfindingState.drawing
&& wayfindingState.currentSectionIndex === (pathSection.length - 1)
&& wayFindingControlsState.arrivedLabel !== pathSection[pathSection.length - 1].to
) {
// If It is Destination Label
if(prevProps.wayfindingState.drawing !== wayfindingState.drawing
&& wayfindingState.currentSectionIndex === (pathSection.length-1)){
this.addArrivalLabel(finalLabelText, pathSection);
} else if (wayfindingState.drawing
&& wayfindingState.currentSectionIndex !== (pathSection.length - 1)) {
// If it is Interchange Label(s)
}
// If it is Interchange Label(s)
else if(wayfindingState.currentSectionIndex !== (pathSection.length-1)){
let icDestinationFloorPosition;
if (pathSection[wayfindingState.currentSectionIndex + 1].to.pathNode.ground.id > kioskPlace.id) {
icDestinationFloorPosition = 'Up ';
} else if (pathSection[wayfindingState.currentSectionIndex + 1].to.pathNode.ground.id < kioskPlace.id) {
icDestinationFloorPosition = 'Down ';
} else {
icDestinationFloorPosition = 'Straight ';
if(pathSection[wayfindingState.currentSectionIndex+1].to.pathNode.ground.id > kioskPlace.id){
icDestinationFloorPosition = "Up ";
}
const icDestinationFloor = pathSection[wayfindingState.currentSectionIndex + 1].to.pathNode.ground.name;
else if(pathSection[wayfindingState.currentSectionIndex+1].to.pathNode.ground.id < kioskPlace.id){
icDestinationFloorPosition = "Down ";
}
else {
icDestinationFloorPosition = "Straight ";
}
const icDestinationFloor = pathSection[wayfindingState.currentSectionIndex+1].to.pathNode.ground.name;
const changeFloorLabelText = icLabelText + icDestinationFloorPosition + icDestinationFloor.replace('_', ' ');
this.addInterchangeLabel(changeFloorLabelText, pathSection);
}
}
}
}
// If ResetMap And WayFinding
// If ResetMap And WayFinding
if (wayFindingControlsState.resetMapAndWayFinding.reset) {
if (wayFindingControlsState.resetMapAndWayFinding.resetWayfinding) {
if(wayFindingControlsState.resetMapAndWayFinding.reset){
const { awm } = this.props;
awm.wayfindingManager.reset();
if(wayFindingControlsState.resetMapAndWayFinding.resetWayfinding){
this.resetAllWayFinding();
}
if (wayFindingControlsState.resetMapAndWayFinding.resetMap) {
resetMap(wayFindingControlsState.resetMapAndWayFinding.resetMapAnimatedOption);
if (wayFindingControlsState.resetMapAndWayFinding.resetMap){
resetMap(wayFindingControlsState.resetMapAndWayFinding.resetMapAnimatedOption)
}

@@ -143,12 +182,12 @@ resetMapAndWayFinding(false, false, false, false);

deleteInterchangeLabel() {
deleteInterchangeLabel(){
const { wayFindingControlsState, awm } = this.props;
for (let i = 0; i < wayFindingControlsState.interchangeLabel.length; i++) {
for(let i = 0; i < wayFindingControlsState.interchangeLabel.length; i++){
const willBeDeletedLabel = Array.from(awm.objectManager.labels).filter(
label => label[1].text === wayFindingControlsState.interchangeLabel[i]
);
)
if (willBeDeletedLabel && willBeDeletedLabel[0]) {
awm.objectManager.removeLabel(willBeDeletedLabel[0][1]);
if (willBeDeletedLabel && willBeDeletedLabel[1]) {
if (willBeDeletedLabel && willBeDeletedLabel[1]){
awm.objectManager.removeLabel(willBeDeletedLabel[1][1]);

@@ -160,55 +199,51 @@ }

addArrivalLabel(finalLabelText, pathSection) {
const {
wayFindingControlsState, resetInterchangeLabel, arrivedLabel, awm
} = this.props;
addArrivalLabel(finalLabelText, pathSection){
const {
wayFindingControlsState,
resetInterchangeLabel,
arrivedLabel,
awm,
arrivalLabelStyle
} = this.props;
if(wayFindingControlsState.interchangeLabel.length>0){
resetInterchangeLabel()
}
const arrivedLabelText = new LabelTextObject({
text: finalLabelText,
offset: {
x: 0,
y: 0,
z: 15,
},
style: {
backgroundColor: '#00437a',
backgroundOpacity: 0.9,
backgroundRadius: 3,
color: '#ffffff',
size: 4,
},
offset: arrivalLabelStyle.offset,
style: arrivalLabelStyle.style
});
if (wayFindingControlsState.interchangeLabel.length > 0) {
resetInterchangeLabel();
if(wayFindingControlsState.arrivedLabel && wayFindingControlsState.arrivedLabel.length>0){
this.resetAllWayFinding();
}
const findDuplicateArrivalLabel = wayFindingControlsState.arrivedLabel.find(element => element === finalLabelText);
if (!findDuplicateArrivalLabel) {
const findDuplicateArrivalLabel = wayFindingControlsState.arrivedLabel.find(function(element) {
return element === finalLabelText;
})
if(!findDuplicateArrivalLabel){
arrivedLabel(finalLabelText);
}
awm.objectManager.addLabelOnAdsumLocation(arrivedLabelText, pathSection[pathSection.length - 1].to);
awm.objectManager.addLabelOnAdsumLocation(arrivedLabelText, pathSection[pathSection.length-1].to);
}
addInterchangeLabel(changeFloorLabelText, pathSection) {
const {
wayFindingControlsState, interchangeLabel, awm, wayfindingState
} = this.props;
addInterchangeLabel(changeFloorLabelText, pathSection){
const {
wayFindingControlsState,
interchangeLabel,
awm,
wayfindingState,
interchangeLabelStyle
} = this.props;
const changeFloorLabel = new LabelTextObject({
text: changeFloorLabelText,
offset: {
x: 0,
y: 0,
z: 15,
},
style: {
backgroundColor: '#00437a',
backgroundOpacity: 0.9,
backgroundRadius: 3,
color: '#ffffff',
size: 4,
},
offset: interchangeLabelStyle.offset,
style: interchangeLabelStyle.style,
});
const findDuplicateIcLabel = wayFindingControlsState.interchangeLabel.find(element => element === changeFloorLabelText);
if (!findDuplicateIcLabel) {
const findDuplicateIcLabel = wayFindingControlsState.interchangeLabel.find(function(element) {
return element === changeFloorLabelText;
})
if(!findDuplicateIcLabel){
interchangeLabel(changeFloorLabelText);

@@ -219,24 +254,35 @@ }

resetAllWayFinding() {
const {
wayFindingControlsState, awm, destination, placeDestination
} = this.props;
resetAllWayFinding(){
const { wayFindingControlsState,
awm,
destination,
placeDestination,
tmtt,
resetArrivalLabel
} = this.props;
if (wayFindingControlsState.arrivedLabel.length > 0) {
const willBeDeletedArrivalLabel = Array.from(awm.objectManager.labels).filter(
label => label[1].text === wayFindingControlsState.arrivedLabel[0]
);
if (willBeDeletedArrivalLabel && willBeDeletedArrivalLabel[0]) {
for (let j = 0; j < willBeDeletedArrivalLabel.length; j++) {
awm.objectManager.removeLabel(willBeDeletedArrivalLabel[j][1]);
if(wayFindingControlsState.arrivedLabel.length>0){
for(let k=0; k<wayFindingControlsState.arrivedLabel.length; k++){
const willBeDeletedArrivalLabel = Array.from(awm.objectManager.labels).filter(
label => label[1].text === wayFindingControlsState.arrivedLabel[k]
)
if (willBeDeletedArrivalLabel && willBeDeletedArrivalLabel[k]) {
for(let j = 0; j < willBeDeletedArrivalLabel.length; j++){
awm.objectManager.removeLabel(willBeDeletedArrivalLabel[j][1]);
}
}
}
resetArrivalLabel();
}
if (wayFindingControlsState.interchangeLabel.length > 0) {
if(wayFindingControlsState.interchangeLabel.length>0){
this.deleteInterchangeLabel();
}
if (wayFindingControlsState.destination) {
if(wayFindingControlsState.takeMeThere){
tmtt([]);
}
if(wayFindingControlsState.destination){
destination(null);
}
if (wayFindingControlsState.placeDestination) {
if(wayFindingControlsState.placeDestination){
placeDestination(null);

@@ -246,7 +292,7 @@ }

render() {
return (
render(){
return(
<React.Fragment>
</React.Fragment>
);
)
}

@@ -262,4 +308,4 @@ }

const mapDispatchToProps = (dispatch: *): MappedDispatchPropsType => ({
takeMeThere: (poi) => {
dispatch(WayFindingControlsActions.takeMeThere(poi));
tmtt: (poi) => {
dispatch(WayFindingControlsActions.tmtt(poi));
},

@@ -281,2 +327,5 @@ destination: (poi) => {

},
resetArrivalLabel: (value) => {
dispatch(WayFindingControlsActions.resetArrivalLabel(value));
},
resetMapAndWayFinding: (reset, resetMap, resetMapAnimatedOption, resetWayfinding) => {

@@ -286,5 +335,5 @@ dispatch(WayFindingControlsActions.resetMapAndWayFinding(

resetMap,
resetMapAnimatedOption,
resetMapAnimatedOption,
resetWayfinding
));
));
},

@@ -291,0 +340,0 @@ resetMap: (animated: boolean = false): void => dispatch(MainActions.resetAction(false, true, animated)),

// @flow
import { WayfindingActions } from '@adactive/arc-map';
// eslint-disable-next-line import/no-unresolved
import store from '../../../../src/store/index';
import { WayfindingActions, MainActions } from '@adactive/arc-map';
import store from './../../../../src/store/index';

@@ -12,3 +11,3 @@ export const tmt = 'tmt';

export const INTERCHANGE_LABEL = 'INTERCHANGE_LABEL';
export const REMOVE_INTERCHANGE_LABEL = 'REMOVE_INTERCHANGE_LABEL';
export const RESET_ARRIVAL_LABEL = 'RESET_ARRIVAL_LABEL';
export const RESET_INTERCHANGE_LABEL = 'RESET_INTERCHANGE_LABEL';

@@ -65,6 +64,6 @@ export const RESET_MAP_AND_WAY_FINDING = 'RESET_MAP_AND_WAY_FINDING';

export function removeInterchangeLabel(value) {
export function resetArrivalLabel(value) {
return (dispatch) => {
dispatch({
type: REMOVE_INTERCHANGE_LABEL,
type: RESET_ARRIVAL_LABEL,
payload: value

@@ -87,16 +86,15 @@ });

resetMap,
resetMapAnimatedOption,
resetWayfinding
) {
return (dispatch) => {
dispatch({
type: RESET_MAP_AND_WAY_FINDING,
payload: {
reset: reset || false,
resetMap: resetMap || false,
resetMapAnimatedOption: resetMapAnimatedOption || false,
resetWayfinding: resetWayfinding || false
}
});
};
resetMapAnimatedOption,
resetWayfinding) {
return (dispatch) => {
dispatch({
type: RESET_MAP_AND_WAY_FINDING,
payload: {
reset: reset ? reset : false,
resetMap: resetMap ? resetMap : false,
resetMapAnimatedOption: resetMapAnimatedOption ? resetMapAnimatedOption : false,
resetWayfinding: resetWayfinding ? resetWayfinding : false
}
});
};
}
// @flow
import {
import {
tmt,

@@ -9,3 +9,3 @@ DESTINATION,

INTERCHANGE_LABEL,
REMOVE_INTERCHANGE_LABEL,
RESET_ARRIVAL_LABEL,
RESET_INTERCHANGE_LABEL,

@@ -21,3 +21,2 @@ RESET_MAP_AND_WAY_FINDING

interchangeLabel: [],
removeInterchangeLabel: false,
resetMapAndWayFinding: {

@@ -57,5 +56,5 @@ reset: false,

});
case REMOVE_INTERCHANGE_LABEL:
case RESET_ARRIVAL_LABEL:
return Object.assign({}, state, {
removeInterchangeLabel: action.payload
arrivedLabel: []
});

@@ -69,2 +68,2 @@ case RESET_MAP_AND_WAY_FINDING:

}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc