UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

19 lines (18 loc) 709 B
"use strict"; import { attribValueNonPrimitive, copyAttribValue } from "../geometry/entities/utils/Common"; import { _getObjectAttributeRef_ } from "./ObjectAttributeReactivity"; function _copyObjectAttribToRef(attribValue, targetRef) { if (attribValueNonPrimitive(attribValue) && attribValueNonPrimitive(targetRef.value)) { copyAttribValue(attribValue, targetRef.value); } else { targetRef.value = attribValue; } } export function _updateObjectAttribRef(object3D, attribName, newValue) { const _ref = _getObjectAttributeRef_(object3D, attribName); if (!_ref) { return; } _copyObjectAttribToRef(_ref.current.value, _ref.previous); _copyObjectAttribToRef(newValue, _ref.current); }