amotify 0.0.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/dist/@comps/@core/bios.d.ts +14 -0
- package/dist/@comps/@core/bios.js +228 -0
- package/dist/@comps/@core/exe.d.ts +9 -0
- package/dist/@comps/@core/exe.js +12 -0
- package/dist/@comps/@core/jsminAmotifyExtension/_.d.ts +4 -0
- package/dist/@comps/@core/jsminAmotifyExtension/_.js +6 -0
- package/dist/@comps/@core/jsminAmotifyExtension/fetch.d.ts +9 -0
- package/dist/@comps/@core/jsminAmotifyExtension/fetch.js +199 -0
- package/dist/@comps/@core/jsminAmotifyExtension/formCollect.d.ts +1 -0
- package/dist/@comps/@core/jsminAmotifyExtension/formCollect.js +137 -0
- package/dist/@comps/@core/jsminAmotifyExtension/spreadSheet.d.ts +4 -0
- package/dist/@comps/@core/jsminAmotifyExtension/spreadSheet.js +314 -0
- package/dist/@comps/@core/jsminAmotifyExtension/variables.d.ts +0 -0
- package/dist/@comps/@core/jsminAmotifyExtension/variables.js +186 -0
- package/dist/@comps/@core/styleConverter.d.ts +2 -0
- package/dist/@comps/@core/styleConverter.js +349 -0
- package/dist/@comps/Atoms/@export.d.ts +4 -0
- package/dist/@comps/Atoms/@export.js +29 -0
- package/dist/@comps/Atoms/FAIcon/parts.d.ts +2 -0
- package/dist/@comps/Atoms/FAIcon/parts.js +153 -0
- package/dist/@comps/Atoms/Logo/parts.d.ts +1 -0
- package/dist/@comps/Atoms/Logo/parts.js +154 -0
- package/dist/@comps/Atoms/Various/parts.d.ts +9 -0
- package/dist/@comps/Atoms/Various/parts.js +113 -0
- package/dist/@comps/Functions/@export.d.ts +12 -0
- package/dist/@comps/Functions/@export.js +38 -0
- package/dist/@comps/Functions/Button/_.d.ts +1 -0
- package/dist/@comps/Functions/Button/_.js +270 -0
- package/dist/@comps/Functions/Cropper/parts.d.ts +1 -0
- package/dist/@comps/Functions/Cropper/parts.js +783 -0
- package/dist/@comps/Functions/Effects/Fade.d.ts +1 -0
- package/dist/@comps/Functions/Effects/Fade.js +80 -0
- package/dist/@comps/Functions/Effects/Ripple.d.ts +1 -0
- package/dist/@comps/Functions/Effects/Ripple.js +107 -0
- package/dist/@comps/Functions/Effects/_.d.ts +3 -0
- package/dist/@comps/Functions/Effects/_.js +43 -0
- package/dist/@comps/Functions/Input/Chips/Selector.d.ts +1 -0
- package/dist/@comps/Functions/Input/Chips/Selector.js +356 -0
- package/dist/@comps/Functions/Input/Chips/_.d.ts +2 -0
- package/dist/@comps/Functions/Input/Chips/_.js +218 -0
- package/dist/@comps/Functions/Input/DigitCharacters.d.ts +1 -0
- package/dist/@comps/Functions/Input/DigitCharacters.js +178 -0
- package/dist/@comps/Functions/Input/File/_.d.ts +2 -0
- package/dist/@comps/Functions/Input/File/_.js +458 -0
- package/dist/@comps/Functions/Input/Hidden.d.ts +1 -0
- package/dist/@comps/Functions/Input/Hidden.js +30 -0
- package/dist/@comps/Functions/Input/List/_.d.ts +1 -0
- package/dist/@comps/Functions/Input/List/_.js +232 -0
- package/dist/@comps/Functions/Input/Segmented/_.d.ts +1 -0
- package/dist/@comps/Functions/Input/Segmented/_.js +111 -0
- package/dist/@comps/Functions/Input/Select/_.d.ts +1 -0
- package/dist/@comps/Functions/Input/Select/_.js +154 -0
- package/dist/@comps/Functions/Input/Slider/_.d.ts +1 -0
- package/dist/@comps/Functions/Input/Slider/_.js +308 -0
- package/dist/@comps/Functions/Input/Switch/_.d.ts +1 -0
- package/dist/@comps/Functions/Input/Switch/_.js +120 -0
- package/dist/@comps/Functions/Input/Text.d.ts +5 -0
- package/dist/@comps/Functions/Input/Text.js +340 -0
- package/dist/@comps/Functions/Input/TextArea.d.ts +1 -0
- package/dist/@comps/Functions/Input/TextArea.js +98 -0
- package/dist/@comps/Functions/Input/Time/Picker.d.ts +1 -0
- package/dist/@comps/Functions/Input/Time/Picker.js +581 -0
- package/dist/@comps/Functions/Input/Time/_.d.ts +2 -0
- package/dist/@comps/Functions/Input/Time/_.js +567 -0
- package/dist/@comps/Functions/Input/_.d.ts +5 -0
- package/dist/@comps/Functions/Input/_.js +446 -0
- package/dist/@comps/Functions/Input/core.d.ts +34 -0
- package/dist/@comps/Functions/Input/core.js +324 -0
- package/dist/@comps/Functions/Inputs/_.d.ts +3 -0
- package/dist/@comps/Functions/Inputs/_.js +7 -0
- package/dist/@comps/Functions/Inputs/text.d.ts +12 -0
- package/dist/@comps/Functions/Inputs/text.js +46 -0
- package/dist/@comps/Functions/Layout/PageNotFound.d.ts +1 -0
- package/dist/@comps/Functions/Layout/PageNotFound.js +30 -0
- package/dist/@comps/Functions/Layout/PageRouter.d.ts +2 -0
- package/dist/@comps/Functions/Layout/PageRouter.js +65 -0
- package/dist/@comps/Functions/Layout/PageViewController/parts.d.ts +1 -0
- package/dist/@comps/Functions/Layout/PageViewController/parts.js +30 -0
- package/dist/@comps/Functions/Layout/Plate.d.ts +1 -0
- package/dist/@comps/Functions/Layout/Plate.js +39 -0
- package/dist/@comps/Functions/Layout/RootViewController/parts.d.ts +1 -0
- package/dist/@comps/Functions/Layout/RootViewController/parts.js +202 -0
- package/dist/@comps/Functions/Layout/SwipeView/parts.d.ts +2 -0
- package/dist/@comps/Functions/Layout/SwipeView/parts.js +319 -0
- package/dist/@comps/Functions/Layout/TabBar.d.ts +1 -0
- package/dist/@comps/Functions/Layout/TabBar.js +49 -0
- package/dist/@comps/Functions/Layout/_.d.ts +2 -0
- package/dist/@comps/Functions/Layout/_.js +20 -0
- package/dist/@comps/Functions/Loader/corner.d.ts +1 -0
- package/dist/@comps/Functions/Loader/corner.js +59 -0
- package/dist/@comps/Functions/Loader/mini.d.ts +33 -0
- package/dist/@comps/Functions/Loader/mini.js +126 -0
- package/dist/@comps/Functions/Loader/parts.d.ts +3 -0
- package/dist/@comps/Functions/Loader/parts.js +108 -0
- package/dist/@comps/Functions/Loader/top.d.ts +1 -0
- package/dist/@comps/Functions/Loader/top.js +69 -0
- package/dist/@comps/Functions/Sheet/parts.d.ts +2 -0
- package/dist/@comps/Functions/Sheet/parts.js +724 -0
- package/dist/@comps/Functions/SnackBar/parts.d.ts +2 -0
- package/dist/@comps/Functions/SnackBar/parts.js +171 -0
- package/dist/@comps/Functions/Table/Data/parts.d.ts +3 -0
- package/dist/@comps/Functions/Table/Data/parts.js +629 -0
- package/dist/@comps/Functions/Table/Drag/parts.d.ts +1 -0
- package/dist/@comps/Functions/Table/Drag/parts.js +359 -0
- package/dist/@comps/Functions/Table/Normal/parts.d.ts +1 -0
- package/dist/@comps/Functions/Table/Normal/parts.js +92 -0
- package/dist/@comps/Functions/Table/_.d.ts +9 -0
- package/dist/@comps/Functions/Table/_.js +153 -0
- package/dist/@comps/Functions/Tooltips/parts.d.ts +2 -0
- package/dist/@comps/Functions/Tooltips/parts.js +71 -0
- package/dist/@comps/Molecules/@export.d.ts +21 -0
- package/dist/@comps/Molecules/@export.js +50 -0
- package/dist/@comps/Molecules/Accordion/parts.d.ts +2 -0
- package/dist/@comps/Molecules/Accordion/parts.js +165 -0
- package/dist/@comps/Molecules/LinkifyText/parts.d.ts +1 -0
- package/dist/@comps/Molecules/LinkifyText/parts.js +39 -0
- package/dist/@comps/Molecules/List.d.ts +1 -0
- package/dist/@comps/Molecules/List.js +35 -0
- package/dist/@comps/Organisms/@export.d.ts +2 -0
- package/dist/@comps/Organisms/@export.js +9 -0
- package/dist/@comps/Organisms/DisplayStyleInput/_.d.ts +1 -0
- package/dist/@comps/Organisms/DisplayStyleInput/_.js +15 -0
- package/dist/@comps/Organisms/DisplayStyleInput/darkmode.d.ts +1 -0
- package/dist/@comps/Organisms/DisplayStyleInput/darkmode.js +77 -0
- package/dist/@comps/Organisms/DisplayStyleInput/themeColor.d.ts +27 -0
- package/dist/@comps/Organisms/DisplayStyleInput/themeColor.js +185 -0
- package/dist/@comps/Templates/@export.d.ts +2 -0
- package/dist/@comps/Templates/@export.js +9 -0
- package/dist/@comps/Templates/PlayGround/parts.d.ts +1 -0
- package/dist/@comps/Templates/PlayGround/parts.js +55 -0
- package/dist/@types/_.d.ts +6 -0
- package/dist/@types/_.js +8 -0
- package/dist/@types/amot.d.ts +260 -0
- package/dist/@types/amot.js +2 -0
- package/dist/@types/fn.d.ts +1040 -0
- package/dist/@types/fn.js +2 -0
- package/dist/@types/index.d.ts +59 -0
- package/dist/@types/index.js +2 -0
- package/dist/@types/jsminAmotifyExtension.d.ts +134 -0
- package/dist/@types/jsminAmotifyExtension.js +2 -0
- package/dist/@types/module.d.ts +2 -0
- package/dist/@types/module.js +1 -0
- package/dist/@types/state.d.ts +145 -0
- package/dist/@types/state.js +2 -0
- package/dist/launch.d.ts +3 -0
- package/dist/launch.js +282 -0
- package/package.json +65 -0
- package/tsconfig.json +48 -0
|
@@ -0,0 +1,783 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
+
if (!m) return o;
|
|
52
|
+
var i = m.call(o), r, ar = [], e;
|
|
53
|
+
try {
|
|
54
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
+
}
|
|
56
|
+
catch (error) { e = { error: error }; }
|
|
57
|
+
finally {
|
|
58
|
+
try {
|
|
59
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
+
}
|
|
61
|
+
finally { if (e) throw e.error; }
|
|
62
|
+
}
|
|
63
|
+
return ar;
|
|
64
|
+
};
|
|
65
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
66
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
67
|
+
if (ar || !(i in from)) {
|
|
68
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
69
|
+
ar[i] = from[i];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
73
|
+
};
|
|
74
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
75
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
76
|
+
};
|
|
77
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
78
|
+
exports.Cropper = void 0;
|
|
79
|
+
var _global_1 = require("@global");
|
|
80
|
+
var _atoms_1 = require("@atoms");
|
|
81
|
+
var _mols_1 = require("@mols");
|
|
82
|
+
var _functions_1 = require("@functions");
|
|
83
|
+
var useState = React.useState, useEffect = React.useEffect;
|
|
84
|
+
var style_module_scss_1 = __importDefault(require("./style.module.scss"));
|
|
85
|
+
var CroppImage = /** @class */ (function () {
|
|
86
|
+
function CroppImage(params) {
|
|
87
|
+
this.set_scale = params.set_scale;
|
|
88
|
+
this.val_file = params.val_file;
|
|
89
|
+
this.develops = params.develops;
|
|
90
|
+
this.use = params.use;
|
|
91
|
+
this.componentID = params.componentID;
|
|
92
|
+
this.scale = {
|
|
93
|
+
current: params.scale.default,
|
|
94
|
+
default: params.scale.default,
|
|
95
|
+
min: params.scale.min,
|
|
96
|
+
max: params.scale.max
|
|
97
|
+
};
|
|
98
|
+
var Canvas = params.canvas;
|
|
99
|
+
var cvsW = Canvas.width, cvsH = Canvas.height;
|
|
100
|
+
var Picture = params.picture.image;
|
|
101
|
+
var pictW = Picture.width, pictH = Picture.height;
|
|
102
|
+
var pictAsp = pictW / pictH;
|
|
103
|
+
this.Canvas = {
|
|
104
|
+
elm: Canvas,
|
|
105
|
+
ctx: Canvas.getContext('2d')
|
|
106
|
+
};
|
|
107
|
+
var frameW = 0, frameH = 0;
|
|
108
|
+
if (this.use == 'profile') {
|
|
109
|
+
frameW = Canvas.width / 3 * 2;
|
|
110
|
+
frameH = Canvas.height / 3 * 2;
|
|
111
|
+
}
|
|
112
|
+
else if (this.use == 'header') {
|
|
113
|
+
frameW = Canvas.width * (7 / 9);
|
|
114
|
+
frameH = frameW / 3;
|
|
115
|
+
}
|
|
116
|
+
var frameX = (Canvas.width - frameW) / 2;
|
|
117
|
+
var frameY = (Canvas.height - frameH) / 2;
|
|
118
|
+
var frameAsp = frameW / frameH;
|
|
119
|
+
this.Picture = {
|
|
120
|
+
elm: Picture,
|
|
121
|
+
originDataUrl: Picture.src,
|
|
122
|
+
aspect: pictAsp,
|
|
123
|
+
revisedAspect: frameAsp > pictAsp
|
|
124
|
+
? frameW / pictW
|
|
125
|
+
: frameH / pictH,
|
|
126
|
+
rotate: params.picture.rotate,
|
|
127
|
+
grayScale: params.picture.grayScale,
|
|
128
|
+
tone: params.picture.tone
|
|
129
|
+
};
|
|
130
|
+
this.pst = {
|
|
131
|
+
frame: {
|
|
132
|
+
x: frameX,
|
|
133
|
+
y: frameY,
|
|
134
|
+
w: frameW,
|
|
135
|
+
h: frameH,
|
|
136
|
+
aspect: frameAsp,
|
|
137
|
+
},
|
|
138
|
+
outImage: { x: 0, y: 0, w: 0, h: 0 },
|
|
139
|
+
imageX: pictW / 2,
|
|
140
|
+
imageY: pictH / 2,
|
|
141
|
+
centerX: cvsW / 2,
|
|
142
|
+
centerY: cvsH / 2
|
|
143
|
+
};
|
|
144
|
+
this.dragEffectInfo = {
|
|
145
|
+
origin: { x: 0, y: 0 },
|
|
146
|
+
frameExpandRate: { x: 0, y: 0 }
|
|
147
|
+
};
|
|
148
|
+
this.pinchEffectInfo = {
|
|
149
|
+
origin: {
|
|
150
|
+
x: 0, y: 0,
|
|
151
|
+
scale: this.scale.current
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
this.modifyImage();
|
|
155
|
+
}
|
|
156
|
+
CroppImage.prototype.dragEffect = function (params) {
|
|
157
|
+
var eventType = params.eventType, x = params.x, y = params.y;
|
|
158
|
+
if (eventType == 'start') {
|
|
159
|
+
var CanvasRect = this.Canvas.elm.position();
|
|
160
|
+
this.dragEffectInfo = {
|
|
161
|
+
origin: { x: x, y: y },
|
|
162
|
+
frameExpandRate: {
|
|
163
|
+
x: this.Canvas.elm.width / CanvasRect.width,
|
|
164
|
+
y: this.Canvas.elm.height / CanvasRect.height
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
var _a = this.dragEffectInfo, origin_1 = _a.origin, frameExpandRate = _a.frameExpandRate;
|
|
170
|
+
var dragX = origin_1.x - x;
|
|
171
|
+
var dragY = origin_1.y - y;
|
|
172
|
+
var scale = this.scale.current * this.Picture.revisedAspect / 100;
|
|
173
|
+
var shiftX = dragX / scale * frameExpandRate.x;
|
|
174
|
+
var shiftY = dragY / scale * frameExpandRate.y;
|
|
175
|
+
if (eventType == 'move') {
|
|
176
|
+
this.drawImage(this.pst.imageX + shiftX, this.pst.imageY + shiftY);
|
|
177
|
+
}
|
|
178
|
+
else if (eventType == 'end') {
|
|
179
|
+
this.drawImage(this.pst.imageX += shiftX, this.pst.imageY += shiftY);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
CroppImage.prototype.pinchEffect = function (params) {
|
|
184
|
+
var eventType = params.eventType, event = params.event;
|
|
185
|
+
var _a = $.getCursor(event.touches[0]), x1 = _a.x, y1 = _a.y;
|
|
186
|
+
var _b = $.getCursor(event.touches[1]), x2 = _b.x, y2 = _b.y;
|
|
187
|
+
var marginX = x2 - x1;
|
|
188
|
+
var marginY = y2 - y1;
|
|
189
|
+
if (eventType == 'start') {
|
|
190
|
+
this.pinchEffectInfo.origin = {
|
|
191
|
+
x: marginX, y: marginY,
|
|
192
|
+
scale: this.scale.current
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
else if (eventType == 'move') {
|
|
196
|
+
var origin_2 = this.pinchEffectInfo.origin;
|
|
197
|
+
var originDist = Math.sqrt(Math.pow(origin_2.x, 2) + Math.pow(origin_2.y, 2));
|
|
198
|
+
var dist = Math.sqrt(Math.pow(marginX, 2) + Math.pow(marginY, 2));
|
|
199
|
+
var margin = dist / originDist;
|
|
200
|
+
var scale = Number(origin_2.scale * margin);
|
|
201
|
+
this.set_scale(scale);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
CroppImage.prototype.updateScale = function (scale) {
|
|
205
|
+
var nextValue = scale;
|
|
206
|
+
nextValue = Math.max(nextValue, this.scale.min);
|
|
207
|
+
nextValue = Math.min(nextValue, this.scale.max);
|
|
208
|
+
this.scale.current = nextValue;
|
|
209
|
+
this.drawImage();
|
|
210
|
+
};
|
|
211
|
+
CroppImage.prototype.updateFilter = function (params) {
|
|
212
|
+
this.Picture.grayScale = params.grayScale;
|
|
213
|
+
this.Picture.tone = params.tone;
|
|
214
|
+
this.Picture.rotate = params.rotate;
|
|
215
|
+
this.modifyImage();
|
|
216
|
+
};
|
|
217
|
+
CroppImage.prototype.modifyImage = function () {
|
|
218
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
219
|
+
var _a, grayScale, tone, rotate, canvas, ctx, image, ImageW, ImageH, newImage, imgData, ColorDir, rCorrect, gCorrect, bCorrect, iH, iW, Index, terminal, k, current, newDataUrl, Picture, pictW, pictH, pictAsp;
|
|
220
|
+
return __generator(this, function (_b) {
|
|
221
|
+
switch (_b.label) {
|
|
222
|
+
case 0:
|
|
223
|
+
_a = this.Picture, grayScale = _a.grayScale, tone = _a.tone, rotate = _a.rotate;
|
|
224
|
+
canvas = document.createElement('canvas');
|
|
225
|
+
ctx = canvas.getContext('2d');
|
|
226
|
+
image = new Image();
|
|
227
|
+
image.src = this.Picture.originDataUrl;
|
|
228
|
+
ImageW = image.width;
|
|
229
|
+
ImageH = image.height;
|
|
230
|
+
if (rotate == 90 || rotate == 270) {
|
|
231
|
+
ImageW = image.height;
|
|
232
|
+
ImageH = image.width;
|
|
233
|
+
}
|
|
234
|
+
canvas.width = ImageW;
|
|
235
|
+
canvas.height = ImageH;
|
|
236
|
+
if (grayScale)
|
|
237
|
+
ctx.filter = 'grayscale(' + grayScale + '%)';
|
|
238
|
+
if (rotate) {
|
|
239
|
+
ctx.translate(ImageW / 2, ImageH / 2);
|
|
240
|
+
ctx.rotate(rotate * Math.PI / 180);
|
|
241
|
+
if ([90, 270].includes(rotate)) {
|
|
242
|
+
ctx.translate(-ImageH / 2, -ImageW / 2);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
ctx.translate(-ImageW / 2, -ImageH / 2);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
ctx.drawImage(image, 0, 0, image.width, image.height);
|
|
249
|
+
newImage = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
|
250
|
+
imgData = newImage.data;
|
|
251
|
+
{
|
|
252
|
+
grayScale /= 100;
|
|
253
|
+
ColorDir = [
|
|
254
|
+
[255, 255, 255],
|
|
255
|
+
[255, 200, 100],
|
|
256
|
+
[170, 170, 255],
|
|
257
|
+
[240, 200, 145],
|
|
258
|
+
[128, 255, 255],
|
|
259
|
+
[255, 128, 255],
|
|
260
|
+
[255, 255, 128],
|
|
261
|
+
[128, 158, 169],
|
|
262
|
+
[128, 112, 162],
|
|
263
|
+
[50, 192, 87],
|
|
264
|
+
[246, 100, 140], // Origin4
|
|
265
|
+
][tone];
|
|
266
|
+
rCorrect = ColorDir[0] / 255;
|
|
267
|
+
gCorrect = ColorDir[1] / 255;
|
|
268
|
+
bCorrect = ColorDir[2] / 255;
|
|
269
|
+
for (iH = 0; iH < ImageH; iH++) {
|
|
270
|
+
for (iW = 0; iW < ImageW; iW++) {
|
|
271
|
+
Index = (iH * ImageW + iW) * 4;
|
|
272
|
+
if (grayScale) {
|
|
273
|
+
terminal = 0.3 * imgData[Index] + 0.59 * imgData[Index + 1] + 0.11 * imgData[Index + 2];
|
|
274
|
+
for (k = 0; k < 3; k++) {
|
|
275
|
+
current = imgData[Index + k];
|
|
276
|
+
imgData[Index + k] = current + (terminal - current) * grayScale;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
imgData[Index] *= rCorrect;
|
|
280
|
+
imgData[Index + 1] *= gCorrect;
|
|
281
|
+
imgData[Index + 2] *= bCorrect;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
ctx.putImageData(newImage, 0, 0);
|
|
286
|
+
newDataUrl = canvas.toDataURL('image/jpeg');
|
|
287
|
+
return [4 /*yield*/, $.ImageLoader(newDataUrl)];
|
|
288
|
+
case 1:
|
|
289
|
+
Picture = _b.sent();
|
|
290
|
+
pictW = Picture.width, pictH = Picture.height;
|
|
291
|
+
pictAsp = pictW / pictH;
|
|
292
|
+
this.Picture = __assign(__assign({}, this.Picture), { elm: Picture, aspect: pictAsp, revisedAspect: this.pst.frame.aspect > pictAsp
|
|
293
|
+
? this.pst.frame.w / pictW
|
|
294
|
+
: this.pst.frame.h / pictH });
|
|
295
|
+
this.drawImage();
|
|
296
|
+
return [2 /*return*/];
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
CroppImage.prototype.drawImage = function (_imageX, _imageY) {
|
|
302
|
+
var _a = this, use = _a.use, ctx = _a.Canvas.ctx, frame = _a.pst.frame;
|
|
303
|
+
var ImageX = _imageX || this.pst.imageX;
|
|
304
|
+
var ImageY = _imageY || this.pst.imageY;
|
|
305
|
+
{
|
|
306
|
+
var scale = this.scale.current / 100;
|
|
307
|
+
var totalScale = this.Picture.revisedAspect * scale;
|
|
308
|
+
var imgX = this.pst.centerX - ImageX * totalScale;
|
|
309
|
+
var imgY = this.pst.centerY - ImageY * totalScale;
|
|
310
|
+
var imgW = this.Picture.elm.width * totalScale;
|
|
311
|
+
var imgH = this.Picture.elm.height * totalScale;
|
|
312
|
+
{
|
|
313
|
+
var minX = this.pst.frame.x + this.pst.frame.w - imgW;
|
|
314
|
+
var maxX = this.pst.frame.x;
|
|
315
|
+
var minY = this.pst.frame.y + this.pst.frame.h - imgH;
|
|
316
|
+
var maxY = this.pst.frame.y;
|
|
317
|
+
var extraX = 0;
|
|
318
|
+
if (imgX < minX)
|
|
319
|
+
extraX = imgX - minX;
|
|
320
|
+
if (imgX > maxX)
|
|
321
|
+
extraX = imgX - maxX;
|
|
322
|
+
var extraY = 0;
|
|
323
|
+
if (imgY < minY)
|
|
324
|
+
extraY = imgY - minY;
|
|
325
|
+
if (imgY > maxY)
|
|
326
|
+
extraY = imgY - maxY;
|
|
327
|
+
this.dragEffectInfo.origin.x += extraX / 2 / this.dragEffectInfo.frameExpandRate.x;
|
|
328
|
+
this.dragEffectInfo.origin.y += extraY / 2 / this.dragEffectInfo.frameExpandRate.y;
|
|
329
|
+
imgX = Math.min(Math.max(imgX, minX), maxX);
|
|
330
|
+
imgY = Math.min(Math.max(imgY, minY), maxY);
|
|
331
|
+
}
|
|
332
|
+
this.pst.outImage = {
|
|
333
|
+
x: imgX, y: imgY,
|
|
334
|
+
w: imgW, h: imgH
|
|
335
|
+
};
|
|
336
|
+
ctx.clearRect(0, 0, this.Canvas.elm.width, this.Canvas.elm.height);
|
|
337
|
+
ctx.drawImage(this.Picture.elm, 0, 0, this.Picture.elm.width, this.Picture.elm.height, imgX, imgY, imgW, imgH);
|
|
338
|
+
}
|
|
339
|
+
{
|
|
340
|
+
if (use == 'profile') {
|
|
341
|
+
ctx.fillStyle = 'rgba( 20,24,20,.3 )';
|
|
342
|
+
ctx.beginPath();
|
|
343
|
+
ctx.arc(this.Canvas.elm.width / 2, this.Canvas.elm.height / 2, this.Canvas.elm.width, 0, Math.PI * 2, true);
|
|
344
|
+
ctx.arc(this.Canvas.elm.width / 2, this.Canvas.elm.height / 2, this.Canvas.elm.width / 3 * 2 / 2, 0, Math.PI * 2, false);
|
|
345
|
+
ctx.closePath();
|
|
346
|
+
ctx.fill();
|
|
347
|
+
}
|
|
348
|
+
else if (use == 'header') {
|
|
349
|
+
ctx.fillStyle = 'rgba( 20,24,20,.3 )';
|
|
350
|
+
}
|
|
351
|
+
ctx.beginPath();
|
|
352
|
+
ctx.moveTo(0, 0);
|
|
353
|
+
ctx.lineTo(this.Canvas.elm.width, 0);
|
|
354
|
+
ctx.lineTo(this.Canvas.elm.width, this.Canvas.elm.height);
|
|
355
|
+
ctx.lineTo(0, this.Canvas.elm.height);
|
|
356
|
+
ctx.lineTo(0, 0);
|
|
357
|
+
ctx.closePath();
|
|
358
|
+
ctx.lineTo(frame.x, frame.y);
|
|
359
|
+
ctx.lineTo(frame.x, frame.y + frame.h);
|
|
360
|
+
ctx.lineTo(frame.x + frame.w, frame.y + frame.h);
|
|
361
|
+
ctx.lineTo(frame.x + frame.w, frame.y);
|
|
362
|
+
ctx.lineTo(frame.x, frame.y);
|
|
363
|
+
ctx.fill();
|
|
364
|
+
var body = $(document.body);
|
|
365
|
+
var themeColorHSL = body.getStyleProperty('--color-theme-hsl');
|
|
366
|
+
ctx.lineWidth = this.Canvas.elm.width / 200;
|
|
367
|
+
ctx.strokeStyle = "hsla( ".concat(themeColorHSL, ",1 )");
|
|
368
|
+
ctx.strokeRect(frame.x, frame.y, frame.w, frame.h);
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
CroppImage.prototype.export = function () {
|
|
372
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
373
|
+
var _a, develops, Picture, _b, outImage, frame, ratioX, ratioY, Left, Right, Top, Bottom, Files, MimeType, index, _c, size, maxSize, width, height, Preview, previewCtx, dataUrl, blob, Ratio, file;
|
|
374
|
+
return __generator(this, function (_d) {
|
|
375
|
+
switch (_d.label) {
|
|
376
|
+
case 0:
|
|
377
|
+
_a = this, develops = _a.develops, Picture = _a.Picture, _b = _a.pst, outImage = _b.outImage, frame = _b.frame;
|
|
378
|
+
ratioX = outImage.w / Picture.elm.width;
|
|
379
|
+
ratioY = outImage.h / Picture.elm.height;
|
|
380
|
+
Left = (frame.x - outImage.x) / ratioX;
|
|
381
|
+
Right = (frame.x - outImage.x + frame.w) / ratioX;
|
|
382
|
+
Top = (frame.y - outImage.y) / ratioY;
|
|
383
|
+
Bottom = (frame.y - outImage.y + frame.h) / ratioY;
|
|
384
|
+
Files = Array.from({ length: develops.length });
|
|
385
|
+
MimeType = 'image/jpeg';
|
|
386
|
+
index = 0;
|
|
387
|
+
_d.label = 1;
|
|
388
|
+
case 1:
|
|
389
|
+
if (!(index < develops.length)) return [3 /*break*/, 6];
|
|
390
|
+
_c = develops[index], size = _c.size, maxSize = _c.maxSize;
|
|
391
|
+
maxSize = maxSize || {
|
|
392
|
+
S: 1024 * 20,
|
|
393
|
+
R: 1024 * 100,
|
|
394
|
+
L: 1024 * 350
|
|
395
|
+
}[size];
|
|
396
|
+
width = {
|
|
397
|
+
S: 144,
|
|
398
|
+
R: 576,
|
|
399
|
+
L: 1152
|
|
400
|
+
}[size];
|
|
401
|
+
height = this.use == 'profile' ? width : width / 3;
|
|
402
|
+
Preview = document.createElement('canvas');
|
|
403
|
+
Preview.width = width;
|
|
404
|
+
Preview.height = height;
|
|
405
|
+
previewCtx = Preview.getContext('2d');
|
|
406
|
+
if (!previewCtx)
|
|
407
|
+
return [2 /*return*/];
|
|
408
|
+
previewCtx.clearRect(0, 0, width, height);
|
|
409
|
+
previewCtx.drawImage(this.Picture.elm, Left, Top, Right - Left, Bottom - Top, 0, 0, width, height);
|
|
410
|
+
dataUrl = Preview.toDataURL(MimeType);
|
|
411
|
+
return [4 /*yield*/, dataUrl.toBlob(MimeType)];
|
|
412
|
+
case 2:
|
|
413
|
+
blob = _d.sent();
|
|
414
|
+
if (!blob)
|
|
415
|
+
return [2 /*return*/];
|
|
416
|
+
if (!(blob.size >= maxSize)) return [3 /*break*/, 4];
|
|
417
|
+
Ratio = maxSize / blob.size;
|
|
418
|
+
dataUrl = Preview.toDataURL(MimeType, Ratio * 0.92);
|
|
419
|
+
return [4 /*yield*/, dataUrl.toBlob(MimeType)];
|
|
420
|
+
case 3:
|
|
421
|
+
blob = _d.sent();
|
|
422
|
+
if (!blob)
|
|
423
|
+
return [2 /*return*/];
|
|
424
|
+
_d.label = 4;
|
|
425
|
+
case 4:
|
|
426
|
+
file = new File([blob], this.val_file.name, { type: MimeType });
|
|
427
|
+
Files[index] = file;
|
|
428
|
+
_d.label = 5;
|
|
429
|
+
case 5:
|
|
430
|
+
index++;
|
|
431
|
+
return [3 /*break*/, 1];
|
|
432
|
+
case 6: return [2 /*return*/, Files];
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
};
|
|
437
|
+
return CroppImage;
|
|
438
|
+
}());
|
|
439
|
+
var Comps = {
|
|
440
|
+
Core: function (params) {
|
|
441
|
+
var val_file = params.val_file, options = params.options, finishedCallback = params.finishedCallback, abortCallback = params.abortCallback;
|
|
442
|
+
var use = options.use, _a = options.develops, develops = _a === void 0 ? [] : _a;
|
|
443
|
+
var _b = __read(useState($.uuidGen(32)), 1), val_componentID = _b[0];
|
|
444
|
+
var DefaultOptions = {
|
|
445
|
+
scale: {
|
|
446
|
+
default: 125,
|
|
447
|
+
min: 100,
|
|
448
|
+
max: 300
|
|
449
|
+
},
|
|
450
|
+
rotate: 0,
|
|
451
|
+
grayScale: 0,
|
|
452
|
+
tone: 0
|
|
453
|
+
};
|
|
454
|
+
var _c = __read(useState(DefaultOptions.scale.default), 2), val_scale = _c[0], set_scale = _c[1];
|
|
455
|
+
var _d = __read(useState(DefaultOptions.rotate), 2), val_rotate = _d[0], set_rotate = _d[1];
|
|
456
|
+
var _e = __read(useState(DefaultOptions.grayScale), 2), val_grayScale = _e[0], set_grayScale = _e[1];
|
|
457
|
+
var _f = __read(useState(DefaultOptions.tone), 2), val_tone = _f[0], set_tone = _f[1];
|
|
458
|
+
useEffect(function () {
|
|
459
|
+
_global_1.useStore.set({
|
|
460
|
+
key: val_componentID,
|
|
461
|
+
value: {}
|
|
462
|
+
});
|
|
463
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
464
|
+
var target, dataUrl, Canvas, __Cropper, _a, UserEffectStart, DragEffect, EventEnd;
|
|
465
|
+
var _b, _c;
|
|
466
|
+
return __generator(this, function (_d) {
|
|
467
|
+
switch (_d.label) {
|
|
468
|
+
case 0:
|
|
469
|
+
amotify.fn.Loader.fn.corner.active();
|
|
470
|
+
return [4 /*yield*/, val_file.read()];
|
|
471
|
+
case 1:
|
|
472
|
+
target = (_d.sent()).target;
|
|
473
|
+
if (!target)
|
|
474
|
+
return [2 /*return*/];
|
|
475
|
+
dataUrl = target.result;
|
|
476
|
+
Canvas = $('#Canvas-' + val_componentID)[0];
|
|
477
|
+
if (!Canvas)
|
|
478
|
+
return [2 /*return*/];
|
|
479
|
+
_a = CroppImage.bind;
|
|
480
|
+
_b = {
|
|
481
|
+
set_scale: set_scale,
|
|
482
|
+
val_file: val_file,
|
|
483
|
+
develops: develops,
|
|
484
|
+
use: use,
|
|
485
|
+
scale: DefaultOptions.scale,
|
|
486
|
+
componentID: val_componentID,
|
|
487
|
+
canvas: Canvas
|
|
488
|
+
};
|
|
489
|
+
_c = {};
|
|
490
|
+
return [4 /*yield*/, $.ImageLoader(dataUrl)];
|
|
491
|
+
case 2:
|
|
492
|
+
__Cropper = new (_a.apply(CroppImage, [void 0, (_b.picture = (_c.image = _d.sent(),
|
|
493
|
+
_c.grayScale = DefaultOptions.grayScale,
|
|
494
|
+
_c.tone = DefaultOptions.tone,
|
|
495
|
+
_c.rotate = DefaultOptions.rotate,
|
|
496
|
+
_c),
|
|
497
|
+
_b)]))();
|
|
498
|
+
_global_1.useStore.set({
|
|
499
|
+
key: val_componentID,
|
|
500
|
+
value: {
|
|
501
|
+
Instance: __Cropper
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
UserEffectStart = function (event) {
|
|
505
|
+
event.preventDefault();
|
|
506
|
+
if (event.touches && event.touches.length > 1) {
|
|
507
|
+
__Cropper.pinchEffect({
|
|
508
|
+
eventType: 'start',
|
|
509
|
+
event: event
|
|
510
|
+
});
|
|
511
|
+
$(document)
|
|
512
|
+
.addEvent({
|
|
513
|
+
eventType: 'touchmove', eventID: 'CropperEffectMove', option: { passive: false },
|
|
514
|
+
callback: function (event) {
|
|
515
|
+
event.preventDefault();
|
|
516
|
+
__Cropper.pinchEffect({
|
|
517
|
+
eventType: 'move',
|
|
518
|
+
event: event
|
|
519
|
+
});
|
|
520
|
+
},
|
|
521
|
+
})
|
|
522
|
+
.addEvent({
|
|
523
|
+
eventType: 'touchend', eventID: 'CropperEffectEnd', option: { passive: false },
|
|
524
|
+
callback: EventEnd,
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
else {
|
|
528
|
+
__Cropper.dragEffect(__assign({ eventType: 'start' }, $.getCursor(event)));
|
|
529
|
+
var type = event.type;
|
|
530
|
+
$(document)
|
|
531
|
+
.addEvent({
|
|
532
|
+
eventType: type == 'touchstart' ? 'touchmove' : 'mousemove', eventID: 'CropperEffectMove', option: { passive: false },
|
|
533
|
+
callback: function (event) {
|
|
534
|
+
DragEffect('move', event);
|
|
535
|
+
},
|
|
536
|
+
})
|
|
537
|
+
.addEvent({
|
|
538
|
+
eventType: type == 'touchstart' ? 'touchend' : 'mouseup', eventID: 'CropperEffectEnd', option: { passive: false },
|
|
539
|
+
callback: function (event) {
|
|
540
|
+
DragEffect('end', event);
|
|
541
|
+
EventEnd(event);
|
|
542
|
+
},
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
DragEffect = function (eventType, event) {
|
|
547
|
+
event.preventDefault();
|
|
548
|
+
__Cropper.dragEffect(__assign({ eventType: eventType }, $.getCursor(event)));
|
|
549
|
+
};
|
|
550
|
+
EventEnd = function (event) {
|
|
551
|
+
event.preventDefault();
|
|
552
|
+
$(document).removeEvent([
|
|
553
|
+
'CropperEffectMove',
|
|
554
|
+
'CropperEffectEnd'
|
|
555
|
+
]);
|
|
556
|
+
};
|
|
557
|
+
$(Canvas)
|
|
558
|
+
.removeEvent([
|
|
559
|
+
'CropperMouseWheel',
|
|
560
|
+
'CropperTouchStart',
|
|
561
|
+
'CropperMouseDown'
|
|
562
|
+
])
|
|
563
|
+
.addEvent({
|
|
564
|
+
eventID: 'CropperMouseWheel',
|
|
565
|
+
eventType: 'wheel',
|
|
566
|
+
callback: function (event) {
|
|
567
|
+
event.preventDefault();
|
|
568
|
+
var bitScale = Number(event.wheelDelta * 0.04);
|
|
569
|
+
var nextScale = __Cropper.scale.current + bitScale;
|
|
570
|
+
nextScale = Math.max(nextScale, __Cropper.scale.min);
|
|
571
|
+
nextScale = Math.min(nextScale, __Cropper.scale.max);
|
|
572
|
+
set_scale(nextScale);
|
|
573
|
+
},
|
|
574
|
+
option: { passive: false }
|
|
575
|
+
})
|
|
576
|
+
.addEvent({
|
|
577
|
+
eventType: 'touchstart', eventID: 'CropperTouchStart',
|
|
578
|
+
callback: UserEffectStart, option: { passive: false }
|
|
579
|
+
})
|
|
580
|
+
.addEvent({
|
|
581
|
+
eventType: 'mousedown', eventID: 'CropperMouseDown',
|
|
582
|
+
callback: UserEffectStart, option: { passive: false }
|
|
583
|
+
});
|
|
584
|
+
setTimeout(function () {
|
|
585
|
+
amotify.fn.Loader.fn.corner.stop();
|
|
586
|
+
}, 1000);
|
|
587
|
+
return [2 /*return*/];
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
}); })();
|
|
591
|
+
}, [val_file.id]);
|
|
592
|
+
useEffect(function () {
|
|
593
|
+
var _a;
|
|
594
|
+
var Instance = (_a = _global_1.useStore.get(val_componentID)) === null || _a === void 0 ? void 0 : _a.Instance;
|
|
595
|
+
if (Instance) {
|
|
596
|
+
Instance.updateScale(val_scale);
|
|
597
|
+
}
|
|
598
|
+
}, [val_scale]);
|
|
599
|
+
useEffect(function () {
|
|
600
|
+
var _a;
|
|
601
|
+
var Instance = (_a = _global_1.useStore.get(val_componentID)) === null || _a === void 0 ? void 0 : _a.Instance;
|
|
602
|
+
if (Instance) {
|
|
603
|
+
Instance.updateFilter({
|
|
604
|
+
grayScale: val_grayScale,
|
|
605
|
+
tone: val_tone,
|
|
606
|
+
rotate: val_rotate
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
}, [val_grayScale, val_tone, val_rotate]);
|
|
610
|
+
return (React.createElement(_functions_1.Sheet.Comps.Body, null,
|
|
611
|
+
React.createElement(_atoms_1.Flex, { className: [style_module_scss_1.default.Wrap, 'Use_' + use].join(' '), flexWrap: false, position: 'relative', overflow: 'hidden', borderRadius: 'inherit', boxShadow: 3, UnderBreakPointStyles: {
|
|
612
|
+
flexType: 'col'
|
|
613
|
+
} },
|
|
614
|
+
React.createElement(_atoms_1.Box, { flexGrid: 3, UnderBreakPointStyles: {
|
|
615
|
+
width: 1,
|
|
616
|
+
padding: 2
|
|
617
|
+
} },
|
|
618
|
+
React.createElement(_atoms_1.Box, { overflow: 'hidden', position: 'relative', backgroundColor: '4.layer.darken', freeCSS: {
|
|
619
|
+
zIndex: 1
|
|
620
|
+
}, UnderBreakPointStyles: {
|
|
621
|
+
borderRadius: '1.tone.primary'
|
|
622
|
+
} },
|
|
623
|
+
React.createElement("canvas", { width: '2400', height: use == 'profile' ? '2400' : '1800', className: style_module_scss_1.default.Canvas, id: 'Canvas-' + val_componentID }))),
|
|
624
|
+
React.createElement(_mols_1.Column, { gap: 0, flexGrid: 2, boxShadow: 3, UnderBreakPointStyles: {
|
|
625
|
+
width: 1,
|
|
626
|
+
maxWidth: 'unset'
|
|
627
|
+
}, freeCSS: {
|
|
628
|
+
maxWidth: 12 * 28
|
|
629
|
+
} },
|
|
630
|
+
React.createElement(_mols_1.Column, { gap: 1, flexSizing: 0, overflow: 'auto', padding: 1.5, UnderBreakPointStyles: {
|
|
631
|
+
flexSizing: 'none'
|
|
632
|
+
} },
|
|
633
|
+
React.createElement(_atoms_1.Box, { flexSizing: 'none', fontSize: '4.thirdTitle', isBoldFont: true }, "\u30D5\u30A3\u30EB\u30BF\u30FC"),
|
|
634
|
+
React.createElement(Comps.SettingRegion, { DefaultOptions: DefaultOptions, val_scale: val_scale, set_scale: set_scale, val_tone: val_tone, set_tone: set_tone, val_grayScale: val_grayScale, set_grayScale: set_grayScale, val_rotate: val_rotate, set_rotate: set_rotate })),
|
|
635
|
+
React.createElement(_atoms_1.Flex, { padding: 1.5, flexSizing: 'none', gap: 1, borderTop: true },
|
|
636
|
+
React.createElement(_functions_1.Buttons.Button.Border.R, { flexGrid: 1, onClick: function () {
|
|
637
|
+
abortCallback();
|
|
638
|
+
} }, "\u30AD\u30E3\u30F3\u30BB\u30EB"),
|
|
639
|
+
React.createElement(_functions_1.Buttons.Button.Prime.R, { flexGrid: 2, onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
640
|
+
var Instance, Files;
|
|
641
|
+
var _a;
|
|
642
|
+
return __generator(this, function (_b) {
|
|
643
|
+
switch (_b.label) {
|
|
644
|
+
case 0:
|
|
645
|
+
Instance = (_a = _global_1.useStore.get(val_componentID)) === null || _a === void 0 ? void 0 : _a.Instance;
|
|
646
|
+
if (!Instance)
|
|
647
|
+
return [2 /*return*/];
|
|
648
|
+
amotify.fn.Loader.fn.mini.active('CropperExportation');
|
|
649
|
+
return [4 /*yield*/, Instance.export()];
|
|
650
|
+
case 1:
|
|
651
|
+
Files = _b.sent();
|
|
652
|
+
setTimeout(function () {
|
|
653
|
+
amotify.fn.Loader.fn.mini.stop('CropperExportation');
|
|
654
|
+
finishedCallback(Files);
|
|
655
|
+
}, 3000);
|
|
656
|
+
return [2 /*return*/];
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
}); } },
|
|
660
|
+
React.createElement(_mols_1.Row.Center, { gap: '1/2' },
|
|
661
|
+
React.createElement(_functions_1.Loader.White.R, { loaderID: 'CropperExportation' }),
|
|
662
|
+
"\u6C7A\u5B9A")))))));
|
|
663
|
+
},
|
|
664
|
+
SettingRegion: function (params) {
|
|
665
|
+
var ToneList = [];
|
|
666
|
+
for (var index = 1; index <= 10; index++) {
|
|
667
|
+
ToneList.push({
|
|
668
|
+
value: index,
|
|
669
|
+
label: React.createElement(React.Fragment, null,
|
|
670
|
+
React.createElement(_atoms_1.Box, { className: [
|
|
671
|
+
style_module_scss_1.default.ToneBall,
|
|
672
|
+
style_module_scss_1.default['ToneBall_' + index]
|
|
673
|
+
].join(' ') }),
|
|
674
|
+
React.createElement(_atoms_1.Box, { textAlign: 'center', flexSizing: 'auto' }, ['', '暖色', '寒色', 'セピア', 'シアン', 'マゼンタ', 'イエロー', 'オリジナル1', 'オリジナル2', 'オリジナル3', 'オリジナル4'][index]))
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
return (React.createElement(React.Fragment, null,
|
|
678
|
+
React.createElement(_mols_1.Column, { gap: '1/3' },
|
|
679
|
+
React.createElement(_atoms_1.Box, null,
|
|
680
|
+
React.createElement(_atoms_1.FAIcon.Rotate, { fontSize: '3.paragraph' }),
|
|
681
|
+
" Rotate"),
|
|
682
|
+
React.createElement(_mols_1.Row.Separate, { flexChilds: 'even', paddingLeft: 2 },
|
|
683
|
+
React.createElement(_functions_1.Buttons.Button.Border.R, { onClick: function () {
|
|
684
|
+
var next = params.val_rotate - 90;
|
|
685
|
+
if (next < 0)
|
|
686
|
+
next += 360;
|
|
687
|
+
params.set_rotate(next);
|
|
688
|
+
} },
|
|
689
|
+
React.createElement(_atoms_1.FAIcon.RotateLeft, null),
|
|
690
|
+
" \u5DE6\u306B\u56DE\u8EE2"),
|
|
691
|
+
React.createElement(_functions_1.Buttons.Button.Border.R, { onClick: function () {
|
|
692
|
+
params.set_rotate((params.val_rotate + 90) % 360);
|
|
693
|
+
} },
|
|
694
|
+
"\u53F3\u306B\u56DE\u8EE2 ",
|
|
695
|
+
React.createElement(_atoms_1.FAIcon.RotateRight, null)))),
|
|
696
|
+
React.createElement(_mols_1.Column, { gap: '1/3' },
|
|
697
|
+
React.createElement(_atoms_1.Box, null,
|
|
698
|
+
React.createElement(_atoms_1.FAIcon, { fontSize: '3.paragraph', d: 'magnifying-glass-plus' }),
|
|
699
|
+
" Zoom"),
|
|
700
|
+
React.createElement(_atoms_1.Box, { paddingLeft: 2 },
|
|
701
|
+
React.createElement(_functions_1.Input.Slider, { override: 'force', value: params.val_scale - 100, min: params.DefaultOptions.scale.min - 100, max: params.DefaultOptions.scale.max - 100, step: 25, onUpdateValidValue: function (_a) {
|
|
702
|
+
var eventType = _a.eventType, value = _a.value;
|
|
703
|
+
params.set_scale(value + 100);
|
|
704
|
+
}, legends: {
|
|
705
|
+
enable: true,
|
|
706
|
+
custom: function (value) {
|
|
707
|
+
var scale = Math.round(100 + value);
|
|
708
|
+
return 'x' + scale / 100;
|
|
709
|
+
}
|
|
710
|
+
} }))),
|
|
711
|
+
React.createElement(_mols_1.Column, { gap: '1/3' },
|
|
712
|
+
React.createElement(_atoms_1.Box, null,
|
|
713
|
+
React.createElement(_atoms_1.FAIcon, { fontSize: '3.paragraph', d: 'palette' }),
|
|
714
|
+
" Gray Scale"),
|
|
715
|
+
React.createElement(_atoms_1.Box, { paddingLeft: 2 },
|
|
716
|
+
React.createElement(_functions_1.Input.Slider, { value: params.val_grayScale, min: 0, max: 100, step: 25, onUpdateValidValue: function (_a) {
|
|
717
|
+
var value = _a.value;
|
|
718
|
+
params.set_grayScale(value);
|
|
719
|
+
}, legends: {
|
|
720
|
+
enable: true,
|
|
721
|
+
custom: function (value) { return (value + '%'); }
|
|
722
|
+
} }))),
|
|
723
|
+
React.createElement(_mols_1.Column, { gap: '1/3' },
|
|
724
|
+
React.createElement(_atoms_1.Box, null,
|
|
725
|
+
React.createElement(_atoms_1.FAIcon, { fontSize: '3.paragraph', d: 'bars-staggered' }),
|
|
726
|
+
" Tone"),
|
|
727
|
+
React.createElement(_atoms_1.Box, { paddingLeft: 2 },
|
|
728
|
+
React.createElement(_functions_1.Input.Radio, { value: params.val_tone, gap: '1/2', cellStyles: {
|
|
729
|
+
isRounded: true,
|
|
730
|
+
borderWidth: 2,
|
|
731
|
+
borderColor: '1.thin',
|
|
732
|
+
padding: '1/2',
|
|
733
|
+
paddingRight: 1,
|
|
734
|
+
fontSize: '1.mini',
|
|
735
|
+
gap: '1/3',
|
|
736
|
+
flexSizing: 'auto'
|
|
737
|
+
}, options: __spreadArray([
|
|
738
|
+
{
|
|
739
|
+
value: 0, label: 'なし',
|
|
740
|
+
padding: ['1/2', 1],
|
|
741
|
+
flexCenter: true
|
|
742
|
+
}
|
|
743
|
+
], __read(ToneList), false), onUpdateValidValue: function (_a) {
|
|
744
|
+
var value = _a.value;
|
|
745
|
+
params.set_tone(value[0]);
|
|
746
|
+
} })))));
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
exports.Cropper = {
|
|
750
|
+
open: function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
751
|
+
var Image, sheetID;
|
|
752
|
+
return __generator(this, function (_a) {
|
|
753
|
+
switch (_a.label) {
|
|
754
|
+
case 0: return [4 /*yield*/, _functions_1.Input.File.fn.openDialog({
|
|
755
|
+
// accept: 'image/jpeg,image/jpg,image/png,image/gif',
|
|
756
|
+
accept: 'image',
|
|
757
|
+
multiple: false
|
|
758
|
+
})];
|
|
759
|
+
case 1:
|
|
760
|
+
Image = _a.sent();
|
|
761
|
+
sheetID = 'CropperImage';
|
|
762
|
+
amotify.fn.Sheet.open({
|
|
763
|
+
sheetID: sheetID,
|
|
764
|
+
type: 'normal.middleCenter',
|
|
765
|
+
size: '3L',
|
|
766
|
+
freeCSS: {
|
|
767
|
+
width: params.use == 'header' ? 12 * 100 : 12 * 80
|
|
768
|
+
},
|
|
769
|
+
content: React.createElement(Comps.Core, { val_file: Image[0], options: params, finishedCallback: function (files) {
|
|
770
|
+
amotify.fn.Sheet.close(sheetID);
|
|
771
|
+
params.onProcessFinished(files);
|
|
772
|
+
}, abortCallback: function () {
|
|
773
|
+
amotify.fn.Sheet.close(sheetID);
|
|
774
|
+
} }),
|
|
775
|
+
closeOption: {
|
|
776
|
+
escapeKeyDown: false
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
return [2 /*return*/];
|
|
780
|
+
}
|
|
781
|
+
});
|
|
782
|
+
}); }
|
|
783
|
+
};
|