@nativescript-community/ui-image 4.1.8 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +354 -286
- package/angular/directives.d.ts +2 -2
- package/angular/esm2020/directives.mjs +15 -0
- package/angular/esm2020/index.mjs +2 -0
- package/angular/esm2020/module.mjs +22 -0
- package/angular/esm2020/nativescript-community-ui-image-angular.mjs +2 -0
- package/angular/fesm2015/nativescript-community-ui-image-angular.mjs +39 -0
- package/angular/fesm2020/nativescript-community-ui-image-angular.mjs +35 -0
- package/angular/module.d.ts +3 -3
- package/angular/package.json +22 -8
- package/blueprint.md +561 -0
- package/{image-common.d.ts → index-common.d.ts} +3 -0
- package/{image-common.js → index-common.js} +30 -7
- package/{image.android.d.ts → index.android.d.ts} +3 -2
- package/{image.android.js → index.android.js} +50 -40
- package/{image.d.ts → index.d.ts} +3 -3
- package/{image.ios.d.ts → index.ios.d.ts} +3 -2
- package/{image.ios.js → index.ios.js} +18 -18
- package/package.json +12 -4
- package/platforms/android/include.gradle +5 -6
- package/platforms/android/java/com/nativescript/image/ScalingBlurPostprocessor.java +0 -2
- package/platforms/android/java/com/nativescript/image/ScalingUtils.java +487 -0
- package/platforms/android/ui_image.aar +0 -0
- package/platforms/ios/Podfile +1 -1
- package/vue/index.js +1 -1
- package/angular/bundles/nativescript-community-ui-image-angular.umd.js +0 -49
- package/angular/bundles/nativescript-community-ui-image-angular.umd.min.js +0 -2
- package/angular/esm2015/directives.js +0 -15
- package/angular/esm2015/index.js +0 -2
- package/angular/esm2015/module.js +0 -21
- package/angular/esm2015/nativescript-community-ui-image-angular.js +0 -2
- package/angular/fesm2015/nativescript-community-ui-image-angular.js +0 -33
- package/image-common.metadata.json +0 -1
- package/image.android.metadata.json +0 -1
- package/image.ios.metadata.json +0 -1
@@ -0,0 +1,487 @@
|
|
1
|
+
package com.nativescript.image;
|
2
|
+
|
3
|
+
import android.graphics.Matrix;
|
4
|
+
import android.graphics.PointF;
|
5
|
+
import android.graphics.Rect;
|
6
|
+
import android.util.Log;
|
7
|
+
|
8
|
+
/** Performs scale type calculations. */
|
9
|
+
public class ScalingUtils {
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Options for scaling the child bounds to the parent bounds.
|
13
|
+
*
|
14
|
+
* <p>Similar to {@link android.widget.ImageView.ScaleType}, but ScaleType.MATRIX is not
|
15
|
+
* supported. To use matrix scaling, use a {@link MatrixDrawable}. An additional scale type
|
16
|
+
* (FOCUS_CROP) is provided.
|
17
|
+
*
|
18
|
+
* <p>
|
19
|
+
*/
|
20
|
+
public interface ScaleType {
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Scales width and height independently, so that the child matches the parent exactly. This may
|
24
|
+
* change the aspect ratio of the child.
|
25
|
+
*/
|
26
|
+
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_XY = ScaleTypeFitXY.INSTANCE;
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Scales the child so that the child's width fits exactly. The height will be cropped if it
|
30
|
+
* exceeds parent's bounds. Aspect ratio is preserved. Child is centered within the parent's
|
31
|
+
* bounds.
|
32
|
+
*/
|
33
|
+
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_X = ScaleTypeFitX.INSTANCE;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Scales the child so that the child's height fits exactly. The width will be cropped if it
|
37
|
+
* exceeds parent's bounds. Aspect ratio is preserved. Child is centered within the parent's
|
38
|
+
* bounds.
|
39
|
+
*/
|
40
|
+
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_Y = ScaleTypeFitY.INSTANCE;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Scales the child so that it fits entirely inside the parent. At least one dimension (width or
|
44
|
+
* height) will fit exactly. Aspect ratio is preserved. Child is aligned to the top-left corner
|
45
|
+
* of the parent.
|
46
|
+
*/
|
47
|
+
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_START = ScaleTypeFitStart.INSTANCE;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Scales the child so that it fits entirely inside the parent. At least one dimension (width or
|
51
|
+
* height) will fit exactly. Aspect ratio is preserved. Child is centered within the parent's
|
52
|
+
* bounds.
|
53
|
+
*/
|
54
|
+
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_CENTER = ScaleTypeFitCenter.INSTANCE;
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Scales the child so that it fits entirely inside the parent. At least one dimension (width or
|
58
|
+
* height) will fit exactly. Aspect ratio is preserved. Child is aligned to the bottom-right
|
59
|
+
* corner of the parent.
|
60
|
+
*/
|
61
|
+
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_END = ScaleTypeFitEnd.INSTANCE;
|
62
|
+
|
63
|
+
/** Performs no scaling. Child is centered within parent's bounds. */
|
64
|
+
com.facebook.drawee.drawable.ScalingUtils.ScaleType CENTER = ScaleTypeCenter.INSTANCE;
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Scales the child so that it fits entirely inside the parent. Unlike FIT_CENTER, if the child
|
68
|
+
* is smaller, no up-scaling will be performed. Aspect ratio is preserved. Child is centered
|
69
|
+
* within parent's bounds.
|
70
|
+
*/
|
71
|
+
com.facebook.drawee.drawable.ScalingUtils.ScaleType CENTER_INSIDE = ScaleTypeCenterInside.INSTANCE;
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Scales the child so that both dimensions will be greater than or equal to the corresponding
|
75
|
+
* dimension of the parent. At least one dimension (width or height) will fit exactly. Child is
|
76
|
+
* centered within parent's bounds.
|
77
|
+
*/
|
78
|
+
com.facebook.drawee.drawable.ScalingUtils.ScaleType CENTER_CROP = ScaleTypeCenterCrop.INSTANCE;
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Scales the child so that both dimensions will be greater than or equal to the corresponding
|
82
|
+
* dimension of the parent. At least one dimension (width or height) will fit exactly. The
|
83
|
+
* child's focus point will be centered within the parent's bounds as much as possible without
|
84
|
+
* leaving empty space. It is guaranteed that the focus point will be visible and centered as
|
85
|
+
* much as possible. If the focus point is set to (0.5f, 0.5f), result will be equivalent to
|
86
|
+
* CENTER_CROP.
|
87
|
+
*/
|
88
|
+
com.facebook.drawee.drawable.ScalingUtils.ScaleType FOCUS_CROP = ScaleTypeFocusCrop.INSTANCE;
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Scales the child so that it fits entirely inside the parent. At least one dimension (width or
|
92
|
+
* height) will fit exactly. Aspect ratio is preserved. Child is aligned to the bottom-left
|
93
|
+
* corner of the parent.
|
94
|
+
*/
|
95
|
+
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_BOTTOM_START = ScaleTypeFitBottomStart.INSTANCE;
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Gets transformation matrix based on the scale type.
|
99
|
+
*
|
100
|
+
* @param outTransform out matrix to store result
|
101
|
+
* @param parentBounds parent bounds
|
102
|
+
* @param childWidth child width
|
103
|
+
* @param childHeight child height
|
104
|
+
* @param focusX focus point x coordinate, relative [0...1]
|
105
|
+
* @param focusY focus point y coordinate, relative [0...1]
|
106
|
+
* @return same reference to the out matrix for convenience
|
107
|
+
*/
|
108
|
+
Matrix getTransform(
|
109
|
+
Matrix outTransform,
|
110
|
+
Rect parentBounds,
|
111
|
+
int childWidth,
|
112
|
+
int childHeight,
|
113
|
+
float focusX,
|
114
|
+
float focusY);
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
/** A convenience base class that has some common logic. */
|
120
|
+
public abstract static class AbstractScaleType implements com.facebook.drawee.drawable.ScalingUtils.ScaleType, com.facebook.drawee.drawable.ScalingUtils.StatefulScaleType {
|
121
|
+
protected Matrix _imageMatrix = null;
|
122
|
+
protected float _imageRotation = 0;
|
123
|
+
public void setImageMatrix(Matrix matrix) {
|
124
|
+
_imageMatrix = matrix;
|
125
|
+
}
|
126
|
+
public void setImageRotation(float rotation) {
|
127
|
+
_imageRotation = rotation;
|
128
|
+
}
|
129
|
+
|
130
|
+
@Override
|
131
|
+
public Object getState() {
|
132
|
+
if (_imageMatrix != null) {
|
133
|
+
return _imageMatrix;
|
134
|
+
}
|
135
|
+
return _imageRotation;
|
136
|
+
}
|
137
|
+
@Override
|
138
|
+
public Matrix getTransform(
|
139
|
+
Matrix outTransform,
|
140
|
+
Rect parentRect,
|
141
|
+
int childWidth,
|
142
|
+
int childHeight,
|
143
|
+
float focusX,
|
144
|
+
float focusY) {
|
145
|
+
float sX = (float) parentRect.width() / (float) childWidth;
|
146
|
+
float sY = (float) parentRect.height() / (float) childHeight;
|
147
|
+
float rotationDelta = _imageRotation % 180;
|
148
|
+
if (rotationDelta != 0) {
|
149
|
+
float destSX = (float) parentRect.width() / (float) childHeight;
|
150
|
+
float destSY = (float) parentRect.height() / (float) childWidth;
|
151
|
+
final float pos = Math.abs(rotationDelta)/90.0f;
|
152
|
+
sX = sX + pos * (destSX - sX);
|
153
|
+
sY = sY + pos * (destSY - sY);
|
154
|
+
}
|
155
|
+
getTransformImpl(outTransform, parentRect, childWidth, childHeight, focusX, focusY, sX, sY);
|
156
|
+
if (_imageMatrix != null) {
|
157
|
+
outTransform.preConcat(_imageMatrix);
|
158
|
+
} else if (_imageRotation != 0) {
|
159
|
+
outTransform.preRotate(_imageRotation, childWidth / 2.0f, childHeight / 2.0f);
|
160
|
+
}
|
161
|
+
|
162
|
+
return outTransform;
|
163
|
+
}
|
164
|
+
|
165
|
+
public abstract void getTransformImpl(
|
166
|
+
Matrix outTransform,
|
167
|
+
Rect parentRect,
|
168
|
+
int childWidth,
|
169
|
+
int childHeight,
|
170
|
+
float focusX,
|
171
|
+
float focusY,
|
172
|
+
float scaleX,
|
173
|
+
float scaleY);
|
174
|
+
}
|
175
|
+
|
176
|
+
private static class ScaleTypeFitXY extends AbstractScaleType {
|
177
|
+
|
178
|
+
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitXY();
|
179
|
+
|
180
|
+
@Override
|
181
|
+
public void getTransformImpl(
|
182
|
+
Matrix outTransform,
|
183
|
+
Rect parentRect,
|
184
|
+
int childWidth,
|
185
|
+
int childHeight,
|
186
|
+
float focusX,
|
187
|
+
float focusY,
|
188
|
+
float scaleX,
|
189
|
+
float scaleY) {
|
190
|
+
float dx = parentRect.left;
|
191
|
+
float dy = parentRect.top;
|
192
|
+
outTransform.setScale(scaleX, scaleY);
|
193
|
+
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
194
|
+
}
|
195
|
+
|
196
|
+
@Override
|
197
|
+
public String toString() {
|
198
|
+
return "fit_xy";
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
private static class ScaleTypeFitStart extends AbstractScaleType {
|
203
|
+
|
204
|
+
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitStart();
|
205
|
+
|
206
|
+
@Override
|
207
|
+
public void getTransformImpl(
|
208
|
+
Matrix outTransform,
|
209
|
+
Rect parentRect,
|
210
|
+
int childWidth,
|
211
|
+
int childHeight,
|
212
|
+
float focusX,
|
213
|
+
float focusY,
|
214
|
+
float scaleX,
|
215
|
+
float scaleY) {
|
216
|
+
float scale = Math.min(scaleX, scaleY);
|
217
|
+
float dx = parentRect.left;
|
218
|
+
float dy = parentRect.top;
|
219
|
+
outTransform.setScale(scale, scale);
|
220
|
+
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
221
|
+
}
|
222
|
+
|
223
|
+
@Override
|
224
|
+
public String toString() {
|
225
|
+
return "fit_start";
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
229
|
+
private static class ScaleTypeFitBottomStart extends AbstractScaleType {
|
230
|
+
|
231
|
+
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitBottomStart();
|
232
|
+
|
233
|
+
@Override
|
234
|
+
public void getTransformImpl(
|
235
|
+
Matrix outTransform,
|
236
|
+
Rect parentRect,
|
237
|
+
int childWidth,
|
238
|
+
int childHeight,
|
239
|
+
float focusX,
|
240
|
+
float focusY,
|
241
|
+
float scaleX,
|
242
|
+
float scaleY) {
|
243
|
+
float scale = Math.min(scaleX, scaleY);
|
244
|
+
float dx = parentRect.left;
|
245
|
+
float dy = parentRect.top + (parentRect.height() - childHeight * scale);
|
246
|
+
outTransform.setScale(scale, scale);
|
247
|
+
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
248
|
+
}
|
249
|
+
|
250
|
+
@Override
|
251
|
+
public String toString() {
|
252
|
+
return "fit_bottom_start";
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
private static class ScaleTypeFitCenter extends AbstractScaleType {
|
257
|
+
|
258
|
+
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitCenter();
|
259
|
+
|
260
|
+
@Override
|
261
|
+
public void getTransformImpl(
|
262
|
+
Matrix outTransform,
|
263
|
+
Rect parentRect,
|
264
|
+
int childWidth,
|
265
|
+
int childHeight,
|
266
|
+
float focusX,
|
267
|
+
float focusY,
|
268
|
+
float scaleX,
|
269
|
+
float scaleY) {
|
270
|
+
float scale = Math.min(scaleX, scaleY);
|
271
|
+
float dx = parentRect.left + (parentRect.width() - childWidth * scale) * 0.5f;
|
272
|
+
float dy = parentRect.top + (parentRect.height() - childHeight * scale) * 0.5f;
|
273
|
+
outTransform.setScale(scale, scale);
|
274
|
+
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
275
|
+
}
|
276
|
+
|
277
|
+
@Override
|
278
|
+
public String toString() {
|
279
|
+
return "fit_center";
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
private static class ScaleTypeFitEnd extends AbstractScaleType {
|
284
|
+
|
285
|
+
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitEnd();
|
286
|
+
|
287
|
+
@Override
|
288
|
+
public void getTransformImpl(
|
289
|
+
Matrix outTransform,
|
290
|
+
Rect parentRect,
|
291
|
+
int childWidth,
|
292
|
+
int childHeight,
|
293
|
+
float focusX,
|
294
|
+
float focusY,
|
295
|
+
float scaleX,
|
296
|
+
float scaleY) {
|
297
|
+
float scale = Math.min(scaleX, scaleY);
|
298
|
+
float dx = parentRect.left + (parentRect.width() - childWidth * scale);
|
299
|
+
float dy = parentRect.top + (parentRect.height() - childHeight * scale);
|
300
|
+
outTransform.setScale(scale, scale);
|
301
|
+
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
302
|
+
}
|
303
|
+
|
304
|
+
@Override
|
305
|
+
public String toString() {
|
306
|
+
return "fit_end";
|
307
|
+
}
|
308
|
+
}
|
309
|
+
|
310
|
+
private static class ScaleTypeCenter extends AbstractScaleType {
|
311
|
+
|
312
|
+
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeCenter();
|
313
|
+
|
314
|
+
@Override
|
315
|
+
public void getTransformImpl(
|
316
|
+
Matrix outTransform,
|
317
|
+
Rect parentRect,
|
318
|
+
int childWidth,
|
319
|
+
int childHeight,
|
320
|
+
float focusX,
|
321
|
+
float focusY,
|
322
|
+
float scaleX,
|
323
|
+
float scaleY) {
|
324
|
+
float dx = parentRect.left + (parentRect.width() - childWidth) * 0.5f;
|
325
|
+
float dy = parentRect.top + (parentRect.height() - childHeight) * 0.5f;
|
326
|
+
outTransform.setTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
327
|
+
}
|
328
|
+
|
329
|
+
@Override
|
330
|
+
public String toString() {
|
331
|
+
return "center";
|
332
|
+
}
|
333
|
+
}
|
334
|
+
|
335
|
+
private static class ScaleTypeCenterInside extends AbstractScaleType {
|
336
|
+
|
337
|
+
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeCenterInside();
|
338
|
+
|
339
|
+
@Override
|
340
|
+
public void getTransformImpl(
|
341
|
+
Matrix outTransform,
|
342
|
+
Rect parentRect,
|
343
|
+
int childWidth,
|
344
|
+
int childHeight,
|
345
|
+
float focusX,
|
346
|
+
float focusY,
|
347
|
+
float scaleX,
|
348
|
+
float scaleY) {
|
349
|
+
float scale = Math.min(Math.min(scaleX, scaleY), 1.0f);
|
350
|
+
float dx = parentRect.left + (parentRect.width() - childWidth * scale) * 0.5f;
|
351
|
+
float dy = parentRect.top + (parentRect.height() - childHeight * scale) * 0.5f;
|
352
|
+
outTransform.setScale(scale, scale);
|
353
|
+
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
354
|
+
}
|
355
|
+
|
356
|
+
@Override
|
357
|
+
public String toString() {
|
358
|
+
return "center_inside";
|
359
|
+
}
|
360
|
+
}
|
361
|
+
|
362
|
+
private static class ScaleTypeCenterCrop extends AbstractScaleType {
|
363
|
+
|
364
|
+
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeCenterCrop();
|
365
|
+
|
366
|
+
@Override
|
367
|
+
public void getTransformImpl(
|
368
|
+
Matrix outTransform,
|
369
|
+
Rect parentRect,
|
370
|
+
int childWidth,
|
371
|
+
int childHeight,
|
372
|
+
float focusX,
|
373
|
+
float focusY,
|
374
|
+
float scaleX,
|
375
|
+
float scaleY) {
|
376
|
+
float scale, dx, dy;
|
377
|
+
if (scaleY > scaleX) {
|
378
|
+
scale = scaleY;
|
379
|
+
dx = parentRect.left + (parentRect.width() - childWidth * scale) * 0.5f;
|
380
|
+
dy = parentRect.top;
|
381
|
+
} else {
|
382
|
+
scale = scaleX;
|
383
|
+
dx = parentRect.left;
|
384
|
+
dy = parentRect.top + (parentRect.height() - childHeight * scale) * 0.5f;
|
385
|
+
}
|
386
|
+
outTransform.setScale(scale, scale);
|
387
|
+
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
388
|
+
}
|
389
|
+
|
390
|
+
@Override
|
391
|
+
public String toString() {
|
392
|
+
return "center_crop";
|
393
|
+
}
|
394
|
+
}
|
395
|
+
|
396
|
+
private static class ScaleTypeFocusCrop extends AbstractScaleType {
|
397
|
+
|
398
|
+
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFocusCrop();
|
399
|
+
|
400
|
+
@Override
|
401
|
+
public void getTransformImpl(
|
402
|
+
Matrix outTransform,
|
403
|
+
Rect parentRect,
|
404
|
+
int childWidth,
|
405
|
+
int childHeight,
|
406
|
+
float focusX,
|
407
|
+
float focusY,
|
408
|
+
float scaleX,
|
409
|
+
float scaleY) {
|
410
|
+
float scale, dx, dy;
|
411
|
+
if (scaleY > scaleX) {
|
412
|
+
scale = scaleY;
|
413
|
+
dx = parentRect.width() * 0.5f - childWidth * scale * focusX;
|
414
|
+
dx = parentRect.left + Math.max(Math.min(dx, 0), parentRect.width() - childWidth * scale);
|
415
|
+
dy = parentRect.top;
|
416
|
+
} else {
|
417
|
+
scale = scaleX;
|
418
|
+
dx = parentRect.left;
|
419
|
+
dy = parentRect.height() * 0.5f - childHeight * scale * focusY;
|
420
|
+
dy = parentRect.top + Math.max(Math.min(dy, 0), parentRect.height() - childHeight * scale);
|
421
|
+
}
|
422
|
+
outTransform.setScale(scale, scale);
|
423
|
+
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
424
|
+
}
|
425
|
+
|
426
|
+
@Override
|
427
|
+
public String toString() {
|
428
|
+
return "focus_crop";
|
429
|
+
}
|
430
|
+
}
|
431
|
+
|
432
|
+
private static class ScaleTypeFitX extends AbstractScaleType {
|
433
|
+
|
434
|
+
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitX();
|
435
|
+
|
436
|
+
@Override
|
437
|
+
public void getTransformImpl(
|
438
|
+
Matrix outTransform,
|
439
|
+
Rect parentRect,
|
440
|
+
int childWidth,
|
441
|
+
int childHeight,
|
442
|
+
float focusX,
|
443
|
+
float focusY,
|
444
|
+
float scaleX,
|
445
|
+
float scaleY) {
|
446
|
+
float scale, dx, dy;
|
447
|
+
scale = scaleX;
|
448
|
+
dx = parentRect.left;
|
449
|
+
dy = parentRect.top + (parentRect.height() - childHeight * scale) * 0.5f;
|
450
|
+
outTransform.setScale(scale, scale);
|
451
|
+
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
452
|
+
}
|
453
|
+
|
454
|
+
@Override
|
455
|
+
public String toString() {
|
456
|
+
return "fit_x";
|
457
|
+
}
|
458
|
+
}
|
459
|
+
|
460
|
+
private static class ScaleTypeFitY extends AbstractScaleType {
|
461
|
+
|
462
|
+
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitY();
|
463
|
+
|
464
|
+
@Override
|
465
|
+
public void getTransformImpl(
|
466
|
+
Matrix outTransform,
|
467
|
+
Rect parentRect,
|
468
|
+
int childWidth,
|
469
|
+
int childHeight,
|
470
|
+
float focusX,
|
471
|
+
float focusY,
|
472
|
+
float scaleX,
|
473
|
+
float scaleY) {
|
474
|
+
float scale, dx, dy;
|
475
|
+
scale = scaleY;
|
476
|
+
dx = parentRect.left + (parentRect.width() - childWidth * scale) * 0.5f;
|
477
|
+
dy = parentRect.top;
|
478
|
+
outTransform.setScale(scale, scale);
|
479
|
+
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
480
|
+
}
|
481
|
+
|
482
|
+
@Override
|
483
|
+
public String toString() {
|
484
|
+
return "fit_y";
|
485
|
+
}
|
486
|
+
}
|
487
|
+
}
|
Binary file
|
package/platforms/ios/Podfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
pod 'SDWebImage', '>= 5.
|
1
|
+
pod 'SDWebImage', '>= 5.13.0'
|
2
2
|
pod 'SDWebImagePhotosPlugin'
|
package/vue/index.js
CHANGED
@@ -1,49 +0,0 @@
|
|
1
|
-
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@nativescript/angular'), require('@nativescript-community/ui-image')) :
|
3
|
-
typeof define === 'function' && define.amd ? define('@nativescript-community/ui-image-angular', ['exports', '@angular/core', '@nativescript/angular', '@nativescript-community/ui-image'], factory) :
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['nativescript-community'] = global['nativescript-community'] || {}, global['nativescript-community']['ui-image-angular'] = {}), global.ng.core, global['ns-angular'], global['ns-image']));
|
5
|
-
}(this, (function (exports, i0, angular, uiImage) { 'use strict';
|
6
|
-
|
7
|
-
var ImgDirective = /** @class */ (function () {
|
8
|
-
function ImgDirective() {
|
9
|
-
}
|
10
|
-
return ImgDirective;
|
11
|
-
}());
|
12
|
-
ImgDirective.ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
|
13
|
-
ImgDirective.ɵdir = i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
|
14
|
-
(function () {
|
15
|
-
i0.ɵsetClassMetadata(ImgDirective, [{
|
16
|
-
type: i0.Directive,
|
17
|
-
args: [{
|
18
|
-
selector: 'NSImg'
|
19
|
-
}]
|
20
|
-
}], function () { return []; }, null);
|
21
|
-
})();
|
22
|
-
var NSIMG_DIRECTIVES = [ImgDirective];
|
23
|
-
|
24
|
-
var TNSImageModule = /** @class */ (function () {
|
25
|
-
function TNSImageModule() {
|
26
|
-
}
|
27
|
-
return TNSImageModule;
|
28
|
-
}());
|
29
|
-
TNSImageModule.ɵmod = i0.ɵɵdefineNgModule({ type: TNSImageModule });
|
30
|
-
TNSImageModule.ɵinj = i0.ɵɵdefineInjector({ factory: function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); } });
|
31
|
-
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(TNSImageModule, { declarations: [ImgDirective], exports: [ImgDirective] }); })();
|
32
|
-
(function () {
|
33
|
-
i0.ɵsetClassMetadata(TNSImageModule, [{
|
34
|
-
type: i0.NgModule,
|
35
|
-
args: [{
|
36
|
-
declarations: [NSIMG_DIRECTIVES],
|
37
|
-
exports: [NSIMG_DIRECTIVES],
|
38
|
-
}]
|
39
|
-
}], null, null);
|
40
|
-
})();
|
41
|
-
angular.registerElement('NSImg', function () { return uiImage.Img; });
|
42
|
-
|
43
|
-
exports.ImgDirective = ImgDirective;
|
44
|
-
exports.TNSImageModule = TNSImageModule;
|
45
|
-
|
46
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
47
|
-
|
48
|
-
})));
|
49
|
-
//# sourceMappingURL=nativescript-community-ui-image-angular.umd.js.map
|
@@ -1,2 +0,0 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@nativescript/angular"),require("@nativescript-community/ui-image")):"function"==typeof define&&define.amd?define("@nativescript-community/ui-image-angular",["exports","@angular/core","@nativescript/angular","@nativescript-community/ui-image"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["nativescript-community"]=e["nativescript-community"]||{},e["nativescript-community"]["ui-image-angular"]={}),e.ng.core,e["ns-angular"],e["ns-image"])}(this,(function(e,t,n,i){"use strict";var r=function(){};r.ɵfac=function(e){return new(e||r)},r.ɵdir=t.ɵɵdefineDirective({type:r,selectors:[["NSImg"]]}),t.ɵsetClassMetadata(r,[{type:t.Directive,args:[{selector:"NSImg"}]}],(function(){return[]}),null);var a=[r],o=function(){};o.ɵmod=t.ɵɵdefineNgModule({type:o}),o.ɵinj=t.ɵɵdefineInjector({factory:function(e){return new(e||o)}}),("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(o,{declarations:[r],exports:[r]}),t.ɵsetClassMetadata(o,[{type:t.NgModule,args:[{declarations:[a],exports:[a]}]}],null,null),n.registerElement("NSImg",(function(){return i.Img})),e.ImgDirective=r,e.TNSImageModule=o,Object.defineProperty(e,"__esModule",{value:!0})}));
|
2
|
-
//# sourceMappingURL=nativescript-community-ui-image-angular.umd.min.js.map
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { Directive } from '@angular/core';
|
2
|
-
import * as i0 from "@angular/core";
|
3
|
-
export class ImgDirective {
|
4
|
-
constructor() { }
|
5
|
-
}
|
6
|
-
ImgDirective.ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
|
7
|
-
ImgDirective.ɵdir = i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
|
8
|
-
(function () { i0.ɵsetClassMetadata(ImgDirective, [{
|
9
|
-
type: Directive,
|
10
|
-
args: [{
|
11
|
-
selector: 'NSImg'
|
12
|
-
}]
|
13
|
-
}], function () { return []; }, null); })();
|
14
|
-
export const NSIMG_DIRECTIVES = [ImgDirective];
|
15
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyZWN0aXZlcy5qcyIsInNvdXJjZVJvb3QiOiIuLi9zcmMvIiwic291cmNlcyI6WyJkaXJlY3RpdmVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxlQUFlLENBQUM7O0FBSzFDLE1BQU0sT0FBTyxZQUFZO0lBQ3JCLGdCQUFlLENBQUM7O3dFQURQLFlBQVk7aURBQVosWUFBWTtvQ0FBWixZQUFZO2NBSHhCLFNBQVM7ZUFBQztnQkFDUCxRQUFRLEVBQUUsT0FBTzthQUNwQjs7QUFJRCxNQUFNLENBQUMsTUFBTSxnQkFBZ0IsR0FBRyxDQUFDLFlBQVksQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgRGlyZWN0aXZlIH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5cbkBEaXJlY3RpdmUoe1xuICAgIHNlbGVjdG9yOiAnTlNJbWcnXG59KVxuZXhwb3J0IGNsYXNzIEltZ0RpcmVjdGl2ZSB7XG4gICAgY29uc3RydWN0b3IoKSB7fVxufVxuZXhwb3J0IGNvbnN0IE5TSU1HX0RJUkVDVElWRVMgPSBbSW1nRGlyZWN0aXZlXTtcbiJdfQ==
|
package/angular/esm2015/index.js
DELETED
@@ -1,2 +0,0 @@
|
|
1
|
-
export * from './module';
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiLi4vc3JjLyIsInNvdXJjZXMiOlsiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsY0FBYyxVQUFVLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJcbmV4cG9ydCAqIGZyb20gJy4vbW9kdWxlJztcbiJdfQ==
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { NgModule } from '@angular/core';
|
2
|
-
import { registerElement } from '@nativescript/angular';
|
3
|
-
import { ImgDirective, NSIMG_DIRECTIVES } from './directives';
|
4
|
-
import { Img } from '@nativescript-community/ui-image';
|
5
|
-
import * as i0 from "@angular/core";
|
6
|
-
import * as i1 from "./directives";
|
7
|
-
export { ImgDirective };
|
8
|
-
export class TNSImageModule {
|
9
|
-
}
|
10
|
-
TNSImageModule.ɵmod = i0.ɵɵdefineNgModule({ type: TNSImageModule });
|
11
|
-
TNSImageModule.ɵinj = i0.ɵɵdefineInjector({ factory: function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); } });
|
12
|
-
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(TNSImageModule, { declarations: [i1.ImgDirective], exports: [i1.ImgDirective] }); })();
|
13
|
-
(function () { i0.ɵsetClassMetadata(TNSImageModule, [{
|
14
|
-
type: NgModule,
|
15
|
-
args: [{
|
16
|
-
declarations: [NSIMG_DIRECTIVES],
|
17
|
-
exports: [NSIMG_DIRECTIVES],
|
18
|
-
}]
|
19
|
-
}], null, null); })();
|
20
|
-
registerElement('NSImg', () => Img);
|
21
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kdWxlLmpzIiwic291cmNlUm9vdCI6Ii4uL3NyYy8iLCJzb3VyY2VzIjpbIm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pDLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUV4RCxPQUFPLEVBQUUsWUFBWSxFQUFFLGdCQUFnQixFQUFFLE1BQU0sY0FBYyxDQUFDO0FBQzlELE9BQU8sRUFBRSxHQUFHLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQzs7O0FBQ3ZELE9BQU8sRUFBRSxZQUFZLEVBQUUsQ0FBQztBQUt4QixNQUFNLE9BQU8sY0FBYzs7a0RBQWQsY0FBYzsyR0FBZCxjQUFjO3dGQUFkLGNBQWM7b0NBQWQsY0FBYztjQUoxQixRQUFRO2VBQUM7Z0JBQ04sWUFBWSxFQUFFLENBQUMsZ0JBQWdCLENBQUM7Z0JBQ2hDLE9BQU8sRUFBRSxDQUFDLGdCQUFnQixDQUFDO2FBQzlCOztBQUdELGVBQWUsQ0FBQyxPQUFPLEVBQUUsR0FBRyxFQUFFLENBQUMsR0FBRyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi4vLi4vcmVmZXJlbmNlcy5kLnRzXCIgLz5cblxuaW1wb3J0IHsgTmdNb2R1bGUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7IHJlZ2lzdGVyRWxlbWVudCB9IGZyb20gJ0BuYXRpdmVzY3JpcHQvYW5ndWxhcic7XG5cbmltcG9ydCB7IEltZ0RpcmVjdGl2ZSwgTlNJTUdfRElSRUNUSVZFUyB9IGZyb20gJy4vZGlyZWN0aXZlcyc7XG5pbXBvcnQgeyBJbWcgfSBmcm9tICdAbmF0aXZlc2NyaXB0LWNvbW11bml0eS91aS1pbWFnZSc7XG5leHBvcnQgeyBJbWdEaXJlY3RpdmUgfTtcbkBOZ01vZHVsZSh7XG4gICAgZGVjbGFyYXRpb25zOiBbTlNJTUdfRElSRUNUSVZFU10sXG4gICAgZXhwb3J0czogW05TSU1HX0RJUkVDVElWRVNdLFxufSlcbmV4cG9ydCBjbGFzcyBUTlNJbWFnZU1vZHVsZSB7fVxuXG5yZWdpc3RlckVsZW1lbnQoJ05TSW1nJywgKCkgPT4gSW1nKTtcbiJdfQ==
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export * from './index';
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmF0aXZlc2NyaXB0LWNvbW11bml0eS11aS1pbWFnZS1hbmd1bGFyLmpzIiwic291cmNlUm9vdCI6Ii4uL3NyYy8iLCJzb3VyY2VzIjpbIm5hdGl2ZXNjcmlwdC1jb21tdW5pdHktdWktaW1hZ2UtYW5ndWxhci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFJQSxjQUFjLFNBQVMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9pbmRleCc7XG4iXX0=
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import { ɵɵdefineDirective, ɵsetClassMetadata, Directive, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule } from '@angular/core';
|
2
|
-
import { registerElement } from '@nativescript/angular';
|
3
|
-
import { Img } from '@nativescript-community/ui-image';
|
4
|
-
|
5
|
-
class ImgDirective {
|
6
|
-
constructor() { }
|
7
|
-
}
|
8
|
-
ImgDirective.ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
|
9
|
-
ImgDirective.ɵdir = ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
|
10
|
-
(function () { ɵsetClassMetadata(ImgDirective, [{
|
11
|
-
type: Directive,
|
12
|
-
args: [{
|
13
|
-
selector: 'NSImg'
|
14
|
-
}]
|
15
|
-
}], function () { return []; }, null); })();
|
16
|
-
const NSIMG_DIRECTIVES = [ImgDirective];
|
17
|
-
|
18
|
-
class TNSImageModule {
|
19
|
-
}
|
20
|
-
TNSImageModule.ɵmod = ɵɵdefineNgModule({ type: TNSImageModule });
|
21
|
-
TNSImageModule.ɵinj = ɵɵdefineInjector({ factory: function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); } });
|
22
|
-
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(TNSImageModule, { declarations: [ImgDirective], exports: [ImgDirective] }); })();
|
23
|
-
(function () { ɵsetClassMetadata(TNSImageModule, [{
|
24
|
-
type: NgModule,
|
25
|
-
args: [{
|
26
|
-
declarations: [NSIMG_DIRECTIVES],
|
27
|
-
exports: [NSIMG_DIRECTIVES],
|
28
|
-
}]
|
29
|
-
}], null, null); })();
|
30
|
-
registerElement('NSImg', () => Img);
|
31
|
-
|
32
|
-
export { ImgDirective, TNSImageModule };
|
33
|
-
//# sourceMappingURL=nativescript-community-ui-image-angular.js.map
|