import { computed, type Ref } from 'vue'

export default (flipH: Ref<boolean | undefined>, flipV: Ref<boolean | undefined>, rotateDeg: Ref<number>) => {
  const transform = computed(() => {
    const scaleX = flipH.value ? -1 : 1
    const scaleY = flipV.value ? -1 : 1
    const scale = (scaleX !== 1 || scaleY !== 1) ? `scale(${scaleX}, ${scaleY})` : ''
    const rotate = rotateDeg.value ? `rotate(${rotateDeg.value}deg)` : ''

    // 变换顺序：先缩放（翻转），再旋转（PPT 惯用顺序）
    return [scale, rotate].filter(Boolean).join(' ')
  })

  return {
    transform,
  }
}