@react-three/postprocessing 2.2.5 → 2.2.6

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/dist/index.cjs.js CHANGED
@@ -428,8 +428,11 @@ var Outline = /*#__PURE__*/React.forwardRef(function Outline(_ref, forwardRef) {
428
428
  xRay: xRay
429
429
  });
430
430
  }, [blendFunction, blur, camera, edgeStrength, height, hiddenEdgeColor, kernelSize, patternTexture, pulseSpeed, scene, visibleEdgeColor, width, xRay]);
431
+ var api = React.useContext(selectionContext);
431
432
  React.useEffect(function () {
432
- if (selection) {
433
+ // Do not allow array selection if declarative selection is active
434
+ // TODO: array selection should probably be deprecated altogether
435
+ if (!api && selection) {
433
436
  effect.selection.set(Array.isArray(selection) ? selection.map(resolveRef) : [resolveRef(selection)]);
434
437
  invalidate();
435
438
  return function () {
@@ -437,12 +440,11 @@ var Outline = /*#__PURE__*/React.forwardRef(function Outline(_ref, forwardRef) {
437
440
  invalidate();
438
441
  };
439
442
  }
440
- }, [effect, selection]);
443
+ }, [effect, selection, api]);
441
444
  React.useEffect(function () {
442
445
  effect.selectionLayer = selectionLayer;
443
446
  invalidate();
444
447
  }, [effect, selectionLayer]);
445
- var api = React.useContext(selectionContext);
446
448
  var ref = React.useRef();
447
449
  React.useEffect(function () {
448
450
  if (api && api.enabled) {
@@ -530,8 +532,11 @@ var SelectiveBloom = /*#__PURE__*/React.forwardRef(function SelectiveBloom(_ref,
530
532
  kernelSize: kernelSize
531
533
  });
532
534
  }, [camera, height, intensity, kernelSize, luminanceSmoothing, luminanceThreshold, scene, width]);
535
+ var api = React.useContext(selectionContext);
533
536
  React.useEffect(function () {
534
- if (selection) {
537
+ // Do not allow array selection if declarative selection is active
538
+ // TODO: array selection should probably be deprecated altogether
539
+ if (!api && selection) {
535
540
  effect.selection.set(Array.isArray(selection) ? selection.map(resolveRef) : [resolveRef(selection)]);
536
541
  invalidate();
537
542
  return function () {
@@ -539,7 +544,7 @@ var SelectiveBloom = /*#__PURE__*/React.forwardRef(function SelectiveBloom(_ref,
539
544
  invalidate();
540
545
  };
541
546
  }
542
- }, [effect, selection]);
547
+ }, [effect, selection, api]);
543
548
  React.useEffect(function () {
544
549
  effect.selection.layer = selectionLayer;
545
550
  invalidate();
@@ -558,7 +563,6 @@ var SelectiveBloom = /*#__PURE__*/React.forwardRef(function SelectiveBloom(_ref,
558
563
  };
559
564
  }
560
565
  }, [effect, lights, selectionLayer]);
561
- var api = React.useContext(selectionContext);
562
566
  var ref = React.useRef();
563
567
  React.useEffect(function () {
564
568
  if (api && api.enabled) {
package/dist/index.js CHANGED
@@ -332,8 +332,11 @@ const Outline = /*#__PURE__*/forwardRef(function Outline(_ref, forwardRef) {
332
332
  blur,
333
333
  xRay
334
334
  }), [blendFunction, blur, camera, edgeStrength, height, hiddenEdgeColor, kernelSize, patternTexture, pulseSpeed, scene, visibleEdgeColor, width, xRay]);
335
+ const api = useContext(selectionContext);
335
336
  useEffect(() => {
336
- if (selection) {
337
+ // Do not allow array selection if declarative selection is active
338
+ // TODO: array selection should probably be deprecated altogether
339
+ if (!api && selection) {
337
340
  effect.selection.set(Array.isArray(selection) ? selection.map(resolveRef) : [resolveRef(selection)]);
338
341
  invalidate();
339
342
  return () => {
@@ -341,12 +344,11 @@ const Outline = /*#__PURE__*/forwardRef(function Outline(_ref, forwardRef) {
341
344
  invalidate();
342
345
  };
343
346
  }
344
- }, [effect, selection]);
347
+ }, [effect, selection, api]);
345
348
  useEffect(() => {
346
349
  effect.selectionLayer = selectionLayer;
347
350
  invalidate();
348
351
  }, [effect, selectionLayer]);
349
- const api = useContext(selectionContext);
350
352
  const ref = useRef();
351
353
  useEffect(() => {
352
354
  if (api && api.enabled) {
@@ -421,8 +423,11 @@ const SelectiveBloom = /*#__PURE__*/forwardRef(function SelectiveBloom(_ref, for
421
423
  height,
422
424
  kernelSize
423
425
  }), [camera, height, intensity, kernelSize, luminanceSmoothing, luminanceThreshold, scene, width]);
426
+ const api = useContext(selectionContext);
424
427
  useEffect(() => {
425
- if (selection) {
428
+ // Do not allow array selection if declarative selection is active
429
+ // TODO: array selection should probably be deprecated altogether
430
+ if (!api && selection) {
426
431
  effect.selection.set(Array.isArray(selection) ? selection.map(resolveRef) : [resolveRef(selection)]);
427
432
  invalidate();
428
433
  return () => {
@@ -430,7 +435,7 @@ const SelectiveBloom = /*#__PURE__*/forwardRef(function SelectiveBloom(_ref, for
430
435
  invalidate();
431
436
  };
432
437
  }
433
- }, [effect, selection]);
438
+ }, [effect, selection, api]);
434
439
  useEffect(() => {
435
440
  effect.selection.layer = selectionLayer;
436
441
  invalidate();
@@ -445,7 +450,6 @@ const SelectiveBloom = /*#__PURE__*/forwardRef(function SelectiveBloom(_ref, for
445
450
  };
446
451
  }
447
452
  }, [effect, lights, selectionLayer]);
448
- const api = useContext(selectionContext);
449
453
  const ref = useRef();
450
454
  useEffect(() => {
451
455
  if (api && api.enabled) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/postprocessing",
3
- "version": "2.2.5",
3
+ "version": "2.2.6",
4
4
  "description": "postprocessing wrapper for React and @react-three/fiber",
5
5
  "keywords": [
6
6
  "postprocessing",