1/* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16import {Component, Input} from '@angular/core'; 17import {assertDefined} from 'common/assert_utils'; 18import {UiPropertyTreeNode} from 'viewers/common/ui_property_tree_node'; 19 20@Component({ 21 selector: 'transform-matrix', 22 template: ` 23 <div *ngIf="matrix" class="matrix"> 24 <p class="mat-body-1"> 25 {{ getVal('dsdx') }} 26 </p> 27 <p class="mat-body-1"> 28 {{ getVal('dsdy') }} 29 </p> 30 <p class="mat-body-1" matTooltip="Translate x"> 31 {{ getVal('tx') }} 32 </p> 33 34 <p class="mat-body-1"> 35 {{ getVal('dtdx') }} 36 </p> 37 <p class="mat-body-1"> 38 {{ getVal('dtdy') }} 39 </p> 40 <p class="mat-body-1" matTooltip="Translate y"> 41 {{ getVal('ty') }} 42 </p> 43 44 <p class="mat-body-1">0</p> 45 <p class="mat-body-1">0</p> 46 <p class="mat-body-1">1</p> 47 </div> 48 `, 49 styles: [ 50 ` 51 .matrix { 52 display: grid; 53 grid-gap: 1px; 54 grid-template-columns: repeat(3, 1fr); 55 text-align: center; 56 } 57 `, 58 ], 59}) 60export class TransformMatrixComponent { 61 @Input() matrix: UiPropertyTreeNode | undefined; 62 63 getVal(name: string): string { 64 return ( 65 assertDefined(this.matrix).getChildByName(name)?.formattedValue() ?? 66 'null' 67 ); 68 } 69} 70