perfect-gui 4.12.4 → 4.12.5
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/package.json +1 -1
- package/src/components/Vector2.js +16 -4
package/package.json
CHANGED
|
@@ -115,13 +115,25 @@ export default class Vector2 {
|
|
|
115
115
|
dot.className = 'p-gui__vector2-dot';
|
|
116
116
|
area.append(dot);
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
// Function to update dot position based on current values
|
|
119
|
+
const updateDotPosition = () => {
|
|
120
|
+
dot.style.left = this.parent._mapLinear(objectX[propX], minX, maxX, 0, area.clientWidth) + 'px';
|
|
121
|
+
dot.style.top = this.parent._mapLinear(objectY[propY], minY, maxY, area.clientHeight, 0) + 'px';
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Initial position
|
|
125
|
+
updateDotPosition();
|
|
126
|
+
|
|
127
|
+
// Observe area resize (e.g., when scrollbars appear/disappear)
|
|
128
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
129
|
+
updateDotPosition();
|
|
130
|
+
});
|
|
131
|
+
resizeObserver.observe(area);
|
|
120
132
|
|
|
121
133
|
Object.defineProperty( objectX, propX, {
|
|
122
134
|
set: val => {
|
|
123
135
|
this.parent.propReferences[propXReferenceIndex] = val;
|
|
124
|
-
|
|
136
|
+
updateDotPosition();
|
|
125
137
|
vector_value.textContent = String( val ) + ', ' + objectY[propY];
|
|
126
138
|
},
|
|
127
139
|
get: () => {
|
|
@@ -132,7 +144,7 @@ export default class Vector2 {
|
|
|
132
144
|
Object.defineProperty( objectY, propY, {
|
|
133
145
|
set: val => {
|
|
134
146
|
this.parent.propReferences[propYReferenceIndex] = val;
|
|
135
|
-
|
|
147
|
+
updateDotPosition();
|
|
136
148
|
vector_value.textContent = objectX[propX] + ', ' + String( val );
|
|
137
149
|
},
|
|
138
150
|
get: () => {
|