@cntrl-site/sdk-nextjs 1.9.13-14 → 1.9.13-16

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.
@@ -111,7 +111,7 @@ class InteractionsRegistry {
111
111
  for (const interaction of this.interactions) {
112
112
  const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
113
113
  const matchingTrigger = interaction.triggers.find(trigger => ('position' in trigger && trigger.position === 0 && trigger.from === currentStateId)
114
- || (trigger.type === 'item-scroll-position' && this.items.find((item) => item.id === trigger.itemId).area[this.layoutId].top * window.innerWidth === 0 && trigger.from === currentStateId));
114
+ || (trigger.type === 'item-scroll-position' && this.items.find((item) => item.id === trigger.itemId) && trigger.from === currentStateId));
115
115
  if (!matchingTrigger)
116
116
  continue;
117
117
  const activeStateId = this.getActiveInteractionState(interaction.id);
@@ -202,10 +202,10 @@ class InteractionsRegistry {
202
202
  triggerPosition = itemArea.top * window.innerWidth;
203
203
  break;
204
204
  case 'center':
205
- triggerPosition = (itemArea.top + itemArea.height / 2) * window.innerWidth;
205
+ triggerPosition = itemArea.top * window.innerWidth - window.innerHeight / 2;
206
206
  break;
207
207
  case 'bottom':
208
- triggerPosition = (itemArea.top + itemArea.height) * window.innerWidth;
208
+ triggerPosition = itemArea.top * window.innerWidth - window.innerHeight;
209
209
  break;
210
210
  default:
211
211
  triggerPosition = itemArea.top * window.innerWidth;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "1.9.13-14",
3
+ "version": "1.9.13-16",
4
4
  "description": "SDK for Next.js",
5
5
  "author": "arsen@momdesign.nyc",
6
6
  "license": "MIT",
@@ -120,7 +120,7 @@ export class InteractionsRegistry implements InteractionsRegistryPort {
120
120
  const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
121
121
  const matchingTrigger = interaction.triggers.find(trigger =>
122
122
  ('position' in trigger && trigger.position === 0 && trigger.from === currentStateId)
123
- || (trigger.type === 'item-scroll-position' && this.items.find((item) => item.id === trigger.itemId)!.area[this.layoutId].top * window.innerWidth === 0 && trigger.from === currentStateId)
123
+ || (trigger.type === 'item-scroll-position' && this.items.find((item) => item.id === trigger.itemId) && trigger.from === currentStateId)
124
124
  );
125
125
  if (!matchingTrigger) continue;
126
126
  const activeStateId = this.getActiveInteractionState(interaction.id);
@@ -205,10 +205,10 @@ export class InteractionsRegistry implements InteractionsRegistryPort {
205
205
  triggerPosition = itemArea.top * window.innerWidth;
206
206
  break;
207
207
  case 'center':
208
- triggerPosition = (itemArea.top + itemArea.height / 2) * window.innerWidth;
208
+ triggerPosition = itemArea.top * window.innerWidth - window.innerHeight / 2;
209
209
  break;
210
210
  case 'bottom':
211
- triggerPosition = (itemArea.top + itemArea.height) * window.innerWidth;
211
+ triggerPosition = itemArea.top * window.innerWidth - window.innerHeight;
212
212
  break;
213
213
  default:
214
214
  triggerPosition = itemArea.top * window.innerWidth;