hart-estate-widget 0.0.60 → 0.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/RotationTab.js +19 -12
- package/package.json +1 -1
@@ -58,15 +58,15 @@ var RotationTab = function RotationTab(_ref) {
|
|
58
58
|
text: _locale.default.getLocaleText('rotate-plan')
|
59
59
|
}];
|
60
60
|
|
61
|
-
var _useState = (0, _react.useState)(
|
61
|
+
var _useState = (0, _react.useState)(false),
|
62
62
|
_useState2 = _slicedToArray(_useState, 2),
|
63
63
|
showInstructions = _useState2[0],
|
64
64
|
setInstructionsState = _useState2[1];
|
65
65
|
|
66
66
|
var _useState3 = (0, _react.useState)(false),
|
67
67
|
_useState4 = _slicedToArray(_useState3, 2),
|
68
|
-
|
69
|
-
|
68
|
+
initialized = _useState4[0],
|
69
|
+
setInitState = _useState4[1];
|
70
70
|
|
71
71
|
var _useState5 = (0, _react.useState)(0),
|
72
72
|
_useState6 = _slicedToArray(_useState5, 2),
|
@@ -80,11 +80,11 @@ var RotationTab = function RotationTab(_ref) {
|
|
80
80
|
|
81
81
|
var updateRotation = function updateRotation() {
|
82
82
|
setActiveIndex(this.index);
|
83
|
-
setAutoplayState(this.looping);
|
84
83
|
};
|
85
84
|
|
86
85
|
var onStart = function onStart() {
|
87
86
|
setInstructionsState(false);
|
87
|
+
setInitState(true);
|
88
88
|
var container = document.querySelector('.widget-tab__threesixty-container');
|
89
89
|
var widgetTab = document.querySelector('.widget-tab');
|
90
90
|
var newRotation = new _threesixty.default(container, {
|
@@ -101,13 +101,12 @@ var RotationTab = function RotationTab(_ref) {
|
|
101
101
|
return !event.shiftKey;
|
102
102
|
}
|
103
103
|
});
|
104
|
+
newRotation.controller = controller;
|
104
105
|
controller.on('panstart', function () {
|
105
106
|
lastIndex = newRotation.index;
|
106
107
|
newRotation.stop();
|
107
108
|
|
108
109
|
newRotation._update = function () {};
|
109
|
-
|
110
|
-
setAutoplayState(newRotation.looping);
|
111
110
|
});
|
112
111
|
controller.on('panend', function () {
|
113
112
|
newRotation.goto(lastIndex);
|
@@ -116,13 +115,21 @@ var RotationTab = function RotationTab(_ref) {
|
|
116
115
|
setRotation(newRotation);
|
117
116
|
};
|
118
117
|
|
119
|
-
var
|
120
|
-
rotation.
|
121
|
-
|
118
|
+
var onEnd = function onEnd() {
|
119
|
+
rotation.controller.pause();
|
120
|
+
rotation.container.style.transform = 'none';
|
121
|
+
rotation.destroy();
|
122
|
+
setActiveIndex(0);
|
123
|
+
setRotation(null);
|
124
|
+
setInitState(false);
|
125
|
+
};
|
126
|
+
|
127
|
+
var openInstructions = function openInstructions() {
|
128
|
+
return setInstructionsState(true);
|
122
129
|
};
|
123
130
|
|
124
131
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
125
|
-
className: "widget-tab__threesixty ".concat(
|
132
|
+
className: "widget-tab__threesixty ".concat(initialized ? 'widget-tab__threesixty--active' : '')
|
126
133
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
127
134
|
className: "widget-tab__threesixty-container",
|
128
135
|
onContextMenu: _helpers.preventRightClick
|
@@ -135,13 +142,13 @@ var RotationTab = function RotationTab(_ref) {
|
|
135
142
|
});
|
136
143
|
}))), !showInstructions && /*#__PURE__*/_react.default.createElement("button", {
|
137
144
|
className: "widget-tab__threesixty-start",
|
138
|
-
onClick:
|
145
|
+
onClick: initialized ? onEnd : openInstructions
|
139
146
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
140
147
|
className: "widget-tab__threesixty-start-icon"
|
141
148
|
}, /*#__PURE__*/_react.default.createElement("img", {
|
142
149
|
src: _rotation.default,
|
143
150
|
alt: "start-icon"
|
144
|
-
})), /*#__PURE__*/_react.default.createElement("span", null, _locale.default.getLocaleText(
|
151
|
+
})), /*#__PURE__*/_react.default.createElement("span", null, _locale.default.getLocaleText(initialized ? 'stop' : 'rotate'))), showInstructions && /*#__PURE__*/_react.default.createElement(_Instructions.default, {
|
145
152
|
disabled: disabled,
|
146
153
|
steps: instructionSteps,
|
147
154
|
onClick: onStart
|