getDeltaProperties method

VisualEffectSubviewProperties getDeltaProperties(
  1. VisualEffectSubviewProperties newProperties
)

Returns a VisualEffectSubviewProperties instance in which only the fields whose values need to be transmitted to the Swift side are populated.

Note that the frame's size and position are represented as an NSSize or an NSPoint object respectively. For this reason, those two properties are treated as a single value.

Implementation

VisualEffectSubviewProperties getDeltaProperties(
    VisualEffectSubviewProperties newProperties) {
  final propertyChange = _getPropertyChange(newProperties);

  double? frameWidth, frameHeight;
  if (propertyChange.hasFrameSizeChanged) {
    frameWidth = newProperties.frameWidth;
    frameHeight = newProperties.frameHeight;
  }

  double? frameX, frameY;
  if (propertyChange.hasFramePositionChanged) {
    frameX = newProperties.frameX;
    frameY = newProperties.frameY;
  }

  final alphaValue =
      propertyChange.hasAlphaValueChanged ? newProperties.alphaValue : null;
  final cornerRadius = propertyChange.hasCornerRadiusChanged
      ? newProperties.cornerRadius
      : null;
  final cornerMask =
      propertyChange.hasCornerMaskChanged ? newProperties.cornerMask : null;
  final effect =
      propertyChange.hasEffectChanged ? newProperties.material : null;
  final state = propertyChange.hasStateChanged ? newProperties.state : null;

  return VisualEffectSubviewProperties(
    frameWidth: frameWidth,
    frameHeight: frameHeight,
    frameX: frameX,
    frameY: frameY,
    alphaValue: alphaValue,
    cornerRadius: cornerRadius,
    cornerMask: cornerMask,
    material: effect,
    state: state,
  );
}