@@ -117,79 +117,34 @@ private void SetToScreenEdge()
117117 {
118118 JCS_ScreenSettings ss = JCS_ScreenSettings . instance ;
119119
120- float half_blackspace_width = ss . BlackspaceWidth ( ) / 2.0f ;
121- float half_blackspace_height = ss . BlackspaceHeight ( ) / 2.0f ;
122-
123- Vector3 newPos = mRectTransform . localPosition ;
124-
125- Vector2 halfAppRect = ( JCS_Canvas . instance . GetAppRect ( ) . sizeDelta / 2.0f ) ;
120+ Vector2 halfAppRect = ( new Vector2 ( ss . STARTING_SCREEN_WIDTH , ss . STARTING_SCREEN_HEIGHT ) ) / 2.0f ;
126121
127122 float halfScreenWidth = ( mRectTransform . sizeDelta . x / 2.0f ) + halfAppRect . x ;
128123 float halfScreenHeight = ( mRectTransform . sizeDelta . y / 2.0f ) + halfAppRect . y ;
129124
130- bool blackspace_w_valid = ( JCS_Mathf . isPositive ( half_blackspace_width ) || half_blackspace_width == 0.0f ) ;
131- bool blackspace_h_valid = ( JCS_Mathf . isPositive ( half_blackspace_height ) || half_blackspace_height == 0.0f ) ;
125+
126+ Vector3 newPos = mRectTransform . localPosition ;
132127
133128 switch ( mASPDirection )
134129 {
135130 case JCS_2D4Direction . TOP :
136131 {
137132 newPos . y += halfScreenHeight ;
138-
139- if ( ss . STARTING_SCREEN_HEIGHT != 0 )
140- {
141- // There is blackspaces on the vertical axis. (top and bottom)
142- if ( blackspace_h_valid )
143- newPos . y -= half_blackspace_height ;
144- // Otherwise should be on the horizontal axis. (left and right)
145- else
146- newPos . y += half_blackspace_width ;
147- }
148133 }
149134 break ;
150135 case JCS_2D4Direction . BOTTOM :
151136 {
152137 newPos . y -= halfScreenHeight ;
153-
154- if ( ss . STARTING_SCREEN_HEIGHT != 0 )
155- {
156- // There is blackspaces on the vertical axis. (top and bottom)
157- if ( blackspace_h_valid )
158- newPos . y += half_blackspace_height ;
159- // Otherwise should be on the horizontal axis. (left and right)
160- else
161- newPos . y -= half_blackspace_width ;
162- }
163138 }
164139 break ;
165140 case JCS_2D4Direction . LEFT :
166141 {
167142 newPos . x -= halfScreenWidth ;
168-
169- if ( ss . STARTING_SCREEN_WIDTH != 0 )
170- {
171- // There is blackspaces on the horizontal axis. (left and right)
172- if ( blackspace_w_valid )
173- newPos . x += half_blackspace_width ;
174- // Otherwise should be on the vertical axis. (top and bottom)
175- else
176- newPos . x -= half_blackspace_height ;
177- }
178143 }
179144 break ;
180145 case JCS_2D4Direction . RIGHT :
181146 {
182147 newPos . x += halfScreenWidth ;
183-
184- if ( ss . STARTING_SCREEN_WIDTH != 0 )
185- {
186- // There is blackspaces on the horizontal axis. (left and right)
187- if ( blackspace_w_valid )
188- newPos . x -= half_blackspace_width ;
189- // Otherwise should be on the vertical axis. (top and bottom)
190- else
191- newPos . x += half_blackspace_height ;
192- }
193148 }
194149 break ;
195150 }
0 commit comments