• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import Curves from '@ohos.curves';
17
18export class Constants {
19  // Immersive animation duration
20  static readonly IMMERSE_ANIM_DURATION = 200;
21  static readonly IMMERSE_ANIM_DELAY = 50;
22
23  // click event
24  static readonly TOGGLE_BAR: string = 'single_photo_toggle_bar';
25
26  // hide bars
27  static readonly HIDE_BARS: string = 'single_photo_hide_bars';
28
29  // show bars
30  static readonly SHOW_BARS: string = 'single_photo_show_bars';
31
32  // pull down to return start
33  static readonly PULL_DOWN_START: string = 'single_photo_pull_down_start';
34
35  // pull down to return end
36  static readonly PULL_DOWN_END: string = 'single_photo_pull_down_end';
37
38  // pull down to return cancel
39  static readonly PULL_DOWN_CANCEL: string = 'single_photo_pull_down_cancel';
40
41  // pull down to return threshold
42  static readonly PULL_DOWN_THRESHOLD: number = 200;
43
44  // data quantity change
45  static readonly DATA_SIZE_CHANGED: string = 'photo_data_size_changed';
46
47  // current data change
48  static readonly DATA_CONTENT_CHANGED: string = 'photo_data_content_changed';
49
50  // video play
51  static readonly VIDEO_PLAY: string = 'single_photo_video_play';
52
53  // video pause
54  static readonly VIDEO_PAUSE: string = 'single_photo_video_pause';
55
56  // popup show
57  static readonly POP_APPEAR: string = 'single_photo_popup_appear';
58
59  // popup disappear
60  static readonly POP_DISAPPEAR: string = 'single_photo_popup_disappear';
61
62  // set favor photo
63  static readonly SET_FAVOR: string = 'single_photo_set_favor';
64
65  // rename photo
66  static readonly RENAME: string = 'single_photo_rename';
67
68  // rotate photo
69  static readonly ROTATE: string = 'single_photo_rotate';
70
71  // delete photo
72  static readonly DELETE: string = 'single_photo_delete';
73
74  // remove photo
75  static readonly Remove: string = 'single_photo_remove';
76
77  // photo show state
78  static readonly PHOTO_SHOW_STATE: string = 'single_photo_show_state';
79
80  // set swiper can swipe
81  static readonly SET_DISABLE_SWIPE: string = 'set_disable_swipe';
82
83  // update photo name
84  static readonly UPDATE_PHOTO_NAME: string = 'update_photo_name';
85
86  // reset default scale
87  static readonly RESET_DEFAULT_SCALE: string = 'reset_default_scale';
88
89  // save scale
90  static readonly SAVE_SCALE: string = 'save_scale';
91
92  // matrix
93  static readonly MATRIX: string = 'matrix';
94
95  // photo browser delete confirm
96  static readonly PHOTO_BROWSER_DELETE_CONFIRM: string = 'photo_browser_delete_confirm';
97
98  // photo browser remove confirm
99  static readonly PHOTO_BROWSER_REMOVE_CONFIRM: string = 'photo_browser_remove_confirm';
100
101  // Scale lower limit
102  static readonly COMPONENT_SCALE_FLOOR: number = 0.5;
103
104  // scale upper limit
105  static readonly COMPONENT_SCALE_CEIL: number = 2.0;
106
107  // when the double-click scale is larger than maxScale, the maxScale is adjusted to 1.2 times the double-click scale
108  static readonly MAX_SCALE_EXTRA_FACTOR: number = 1.2;
109
110  // After reaching max scale, you can also scale an additional 0.2x max scale, and rebound after letting go
111  static readonly OVER_SCALE_EXTRA_FACTOR: number = 1.5;
112
113  // If the aspect ratio of the picture is the same as the display area,
114  // double-click to adjust the zoom factor to 4 / 3
115  static readonly RATIO_SCALE_WIDTH: number = 4;
116  static readonly RATIO_SCALE_HEIGHT: number = 3;
117  static readonly SAME_RATIO_SCALE_FACTOR: number = Constants.RATIO_SCALE_WIDTH / Constants.RATIO_SCALE_HEIGHT;
118
119  static readonly CURVE_X1: number = 0.2;
120  static readonly CURVE_Y1: number = 0.2;
121  static readonly CURVE_X2: number = 0.1;
122  static readonly CURVE_Y2: number = 1.0;
123  static readonly PHOTO_TRANSITION_CURVE: string =
124    Curves.cubicBezier(Constants.CURVE_X1, Constants.CURVE_Y1, Constants.CURVE_X2, Constants.CURVE_Y2);
125
126  // GeometryTransition constants
127  static readonly CAN_PULL_DOWN_DRAG_THRESHOLD: number = 10;
128  static readonly SPRING_MOTION_RESPONSE: number = 0.347;
129  static readonly SPRING_MOTION_DAMPING_FRACTION: number = 0.99;
130  static readonly SPRING_MOTION_CURVE: Curves.ICurve =
131    Curves.springMotion(Constants.SPRING_MOTION_RESPONSE, Constants.SPRING_MOTION_DAMPING_FRACTION);
132
133  // Drag image curve constants
134  static readonly DRAG_SCALE: number = 0.0013;
135  static readonly MIN_DRAG_SCALE: number = 0.5;
136  static readonly DRAG_OPACITY: number = 0.0026;
137
138  static readonly RESPONSIVE_SPRING_MOTION_RESPONSE: number = 0.15;
139  static readonly RESPONSIVE_SPRING_MOTION_DAMPING_FRACTION: number = 0.86;
140  static readonly RESPONSIVE_SPRING_MOTION_OVERLAP_DURATION: number = 0.25;
141  static readonly RESPONSIVE_SPRING_MOTION_CURVE: Curves.ICurve =
142  Curves.responsiveSpringMotion(Constants.RESPONSIVE_SPRING_MOTION_RESPONSE,
143    Constants.RESPONSIVE_SPRING_MOTION_DAMPING_FRACTION, Constants.RESPONSIVE_SPRING_MOTION_OVERLAP_DURATION);
144
145  // overScale animation duration
146  static readonly OVER_SCALE_ANIME_DURATION: number = 500;
147  static readonly ROTATE_ONCE: number = 90;
148  static readonly ROTATE_TWICE: number = 180;
149  static readonly ROTATE_THRICE: number = 270;
150  static readonly ROTATE_QUARTIC: number = 360;
151  static readonly DEFAULT_SIZE: number = 256;
152  static readonly OPERATION_EXIT_ANIMATION_DURATION: number = 100;
153  static readonly SHARE_TRANSITION_DURATION: number = 200;
154  static readonly PAGE_SHOW_ANIMATION_DURATION: number = 200;
155  static readonly PHOTO_GRID_ANIMATION_DURATION: number = 300;
156  static readonly PHOTO_SWIPE_DURATION: number = 300;
157  static readonly RESERVED_DIGITS: number = 6;
158  static readonly CENTER_DEFAULT: number = 0.5;
159  static readonly NUMBER_2: number = 2;
160  static readonly NUMBER_3: number = 3;
161  static readonly NUMBER_12: number = 12;
162  static readonly NUMBER_13: number = 13;
163
164  static readonly PHOTO_GRID_Scale: number = 0.8
165  static readonly Album_Scale: number = 1.2
166  static readonly LINK_IN_PHOTO_GRID_DELAY: number = 100;
167  static readonly PC_LINK_IN_PHOTO_GRID_ACTIONBAR_DURATION: number = 150;
168  static readonly PC_LINK_OUT_PHOTO_GRID_ACTIONBAR_DURATION: number = 200;
169  static readonly PC_LINK_ALBUM_DURATION: number = 200;
170  static readonly PC_LINK_OUT_PHOTO_GRID_DURATION: number = 150;
171  static readonly PC_LINK_IN_PHOTO_GRID_DURATION: number = 200;
172  static readonly PC_LINK_IN_ALBUM_ACTIONBAR_DURATION: number = 150;
173  static readonly PC_LINK_OUT_ALBUM_ACTIONBAR_DURATION: number = 200;
174  static readonly PC_LINK_IN_SIDEBAR_DURATION: number = 150;
175  static readonly PC_LINK_OUT_SIDEBAR_DURATION: number = 200;
176  static readonly PC_LINK_OUT_SIDEBAR_DELAY: number = 0;
177  static readonly PC_LINK_IN_ALBUM_DURATION: number = 200;
178  static readonly PC_LINK_IN_ALBUM_DELAY: number = 50;
179  static readonly PC_LINK_OUT_SIDEBAR_BOUNDARY_LINE_DURATION: number = 150;
180  static readonly PC_LINK_OUT_SIDEBAR_BOUNDARY_LINE_DELAY: number = 250;
181  static readonly PC_LINK_ALBUM_TO_PHOTO_GRID_DURATION: number = 400;
182  static readonly PC_LINK_ALBUM_TO_PHOTO_GRID_SCALE_DURATION: number = 400;
183  static readonly PC_LINK_PHOTO_GRID_TO_ALBUM_DURATION: number = 400;
184  static readonly PC_LINK_PHOTO_GRID_TO_ALBUM_SCALE_DURATION: number = 400;
185  static readonly PC_LINK_OUT_ALBUM_ACTIONBAR_DELAY: number = 50;
186  static readonly PC_LINK_PHOTO_GRID_ACTIONBAR_DELAY: number = 100;
187
188  static readonly PHONE_LINK_IN_PHOTO_GRID_ACTIONBAR_DURATION: number = 250;
189  static readonly PHONE_LINK_OUT_PHOTO_GRID_ACTIONBAR_DURATION: number = 175;
190  static readonly PHONE_LINK_PHOTO_GRID_ACTIONBAR_DELAY: number = 250;
191  static readonly PHONE_LINK_ALBUM_ACTIONBAR_DURATION: number = 250;
192  static readonly PHONE_LINK_ALBUM_ACTIONBAR_DELAY: number = 100;
193  static readonly PHONE_LINK_IN_TAB_BAR_DURATION: number = 250;
194  static readonly PHONE_LINK_OUT_TAB_BAR_DURATION: number = 175;
195  static readonly PHONE_LINK_ALBUM_TO_PHOTO_GRID_DURATION: number = 500;
196  static readonly PHONE_LINK_ALBUM_TO_PHOTO_GRID_SCALE_DURATION: number = 500;
197  static readonly PHONE_LINK_PHOTO_GRID_TO_ALBUM_DURATION: number = 350;
198  static readonly PHONE_LINK_PHOTO_GRID_TO_ALBUM_SCALE_DURATION: number = 350;
199}