amotify 0.0.65 → 0.0.66
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/amotify.js +3 -2
- package/dist/amotify.min.css +2 -2
- package/dist/coreVender.js +14 -2
- package/package.json +10 -10
- package/tsconfig.json +13 -5
- package/@types/_.tsx +0 -7
- package/@types/amot.tsx +0 -355
- package/@types/fn.tsx +0 -1280
- package/@types/jsminAmotifyExtension.tsx +0 -137
- package/@types/module.tsx +0 -1
- package/@types/state.tsx +0 -231
- package/src/@atoms.tsx +0 -34
- package/src/@functions.tsx +0 -29
- package/src/@global.tsx +0 -145
- package/src/@jsminAmotifyExtension/_.tsx +0 -4
- package/src/@jsminAmotifyExtension/fetch.tsx +0 -110
- package/src/@jsminAmotifyExtension/formCollect.tsx +0 -94
- package/src/@jsminAmotifyExtension/spreadSheet.tsx +0 -165
- package/src/@jsminAmotifyExtension/variables.tsx +0 -137
- package/src/@molecules.tsx +0 -96
- package/src/@organisms.tsx +0 -1
- package/src/@reactPacks/reactProduction@18.2.0.js +0 -79
- package/src/@reactPacks/reactRouterDomProduction@18.2.0.js +0 -31
- package/src/@styles/@app.scss +0 -4
- package/src/@styles/UniStyling.scss +0 -1028
- package/src/@styles/init.scss +0 -94
- package/src/@styles/props.scss +0 -109
- package/src/@styles/styleSet.scss +0 -38
- package/src/@styles/themeColor.scss +0 -71
- package/src/@styles/var.scss +0 -182
- package/src/@templates.tsx +0 -7
- package/src/@variables.tsx +0 -74
- package/src/atoms/FAI/parts.tsx +0 -139
- package/src/atoms/Logo/parts.tsx +0 -335
- package/src/atoms/Logo/style.module.scss +0 -96
- package/src/atoms/Various/parts.tsx +0 -159
- package/src/atoms/Various/style.module.scss +0 -46
- package/src/config.tsx +0 -191
- package/src/functions/Button/_.tsx +0 -331
- package/src/functions/Button/style.module.scss +0 -157
- package/src/functions/Cropper/parts.tsx +0 -1084
- package/src/functions/Cropper/style.module.scss +0 -64
- package/src/functions/Effects/Fade.tsx +0 -76
- package/src/functions/Effects/Ripple.tsx +0 -141
- package/src/functions/Effects/_.tsx +0 -33
- package/src/functions/Effects/style.module.scss +0 -91
- package/src/functions/Input/Chips/Selector.tsx +0 -445
- package/src/functions/Input/Chips/_.tsx +0 -289
- package/src/functions/Input/Chips/style.module.scss +0 -6
- package/src/functions/Input/Contenteditable.tsx +0 -114
- package/src/functions/Input/DigitCharacters.tsx +0 -235
- package/src/functions/Input/File/_.tsx +0 -553
- package/src/functions/Input/File/style.module.scss +0 -34
- package/src/functions/Input/Hidden.tsx +0 -21
- package/src/functions/Input/List/_.tsx +0 -383
- package/src/functions/Input/List/style.module.scss +0 -84
- package/src/functions/Input/RichSelect/_.tsx +0 -230
- package/src/functions/Input/RichSelect/style.module.scss +0 -11
- package/src/functions/Input/Segmented/_.tsx +0 -246
- package/src/functions/Input/Segmented/style.module.scss +0 -81
- package/src/functions/Input/Select/_.tsx +0 -218
- package/src/functions/Input/Select/style.module.scss +0 -11
- package/src/functions/Input/Slider/_.tsx +0 -524
- package/src/functions/Input/Slider/style.module.scss +0 -67
- package/src/functions/Input/Switch/_.tsx +0 -176
- package/src/functions/Input/Switch/style.module.scss +0 -18
- package/src/functions/Input/Text.tsx +0 -487
- package/src/functions/Input/TextArea.tsx +0 -109
- package/src/functions/Input/Time/Picker.tsx +0 -1361
- package/src/functions/Input/Time/_.tsx +0 -749
- package/src/functions/Input/Time/style.module.scss +0 -79
- package/src/functions/Input/_.tsx +0 -881
- package/src/functions/Input/core.tsx +0 -473
- package/src/functions/Input/style.module.scss +0 -102
- package/src/functions/Inputs/_.tsx +0 -5
- package/src/functions/Inputs/style.module.scss +0 -15
- package/src/functions/Inputs/text.tsx +0 -53
- package/src/functions/Inputs/types.d.ts +0 -13
- package/src/functions/Layout/PageNotFound.tsx +0 -78
- package/src/functions/Layout/PageRouter.tsx +0 -89
- package/src/functions/Layout/PageViewController/parts.tsx +0 -27
- package/src/functions/Layout/Plate.tsx +0 -30
- package/src/functions/Layout/RootViewController/parts.tsx +0 -300
- package/src/functions/Layout/RootViewController/style.module.scss +0 -23
- package/src/functions/Layout/SwipeView/parts.tsx +0 -375
- package/src/functions/Layout/SwipeView/style.module.scss +0 -20
- package/src/functions/Layout/TabBar.tsx +0 -60
- package/src/functions/Layout/_.tsx +0 -20
- package/src/functions/Loader/corner.tsx +0 -74
- package/src/functions/Loader/mini.tsx +0 -114
- package/src/functions/Loader/parts.tsx +0 -103
- package/src/functions/Loader/style.module.scss +0 -223
- package/src/functions/Loader/top.tsx +0 -84
- package/src/functions/Sheet/parts.tsx +0 -994
- package/src/functions/Sheet/style.module.scss +0 -208
- package/src/functions/SnackBar/parts.tsx +0 -215
- package/src/functions/SnackBar/style.module.scss +0 -25
- package/src/functions/Table/Data/parts.tsx +0 -965
- package/src/functions/Table/Drag/parts.tsx +0 -442
- package/src/functions/Table/Normal/parts.tsx +0 -124
- package/src/functions/Table/_.tsx +0 -177
- package/src/functions/Table/style.module.scss +0 -93
- package/src/functions/Tooltips/parts.tsx +0 -53
- package/src/global/LaunchReactApplication.tsx +0 -40
- package/src/global/styleConverter.tsx +0 -465
- package/src/launch.tsx +0 -117
- package/src/molecules/Accordion/parts.tsx +0 -146
- package/src/molecules/Accordion/style.module.scss +0 -13
- package/src/molecules/LinkifyText/parts.tsx +0 -52
- package/src/molecules/List.tsx +0 -31
- package/src/preload.tsx +0 -31
- package/src/templates/PlayGround/parts.tsx +0 -96
- package/src/templates/PlayGround/style.module.scss +0 -38
- package/webpack.config.js +0 -146
|
@@ -1,1084 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useStore,
|
|
3
|
-
React
|
|
4
|
-
} from '@global'
|
|
5
|
-
import {
|
|
6
|
-
Box,
|
|
7
|
-
Flex,
|
|
8
|
-
FAI
|
|
9
|
-
} from '@atoms'
|
|
10
|
-
import {
|
|
11
|
-
Column,
|
|
12
|
-
Row,
|
|
13
|
-
Text
|
|
14
|
-
} from '@mols'
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
Buttons,
|
|
18
|
-
Input,
|
|
19
|
-
Sheet,
|
|
20
|
-
Loader
|
|
21
|
-
} from '@fn'
|
|
22
|
-
|
|
23
|
-
import { faPalette } from '@fortawesome/free-solid-svg-icons/faPalette'
|
|
24
|
-
import { faBarsStaggered } from '@fortawesome/free-solid-svg-icons/faBarsStaggered'
|
|
25
|
-
import { faRotateLeft } from '@fortawesome/free-solid-svg-icons/faRotateLeft'
|
|
26
|
-
import { faRotateRight } from '@fortawesome/free-solid-svg-icons/faRotateRight'
|
|
27
|
-
|
|
28
|
-
import style from './style.module.scss'
|
|
29
|
-
|
|
30
|
-
type CoreProps = {
|
|
31
|
-
val_file: amotify.fn.Input.Filer.CustomFile
|
|
32
|
-
options: amotify.fn.Cropper.Params
|
|
33
|
-
finishedCallback( files: amotify.fn.Input.Filer.CustomFile[] ): void
|
|
34
|
-
abortCallback(): void
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
class CroppImage {
|
|
38
|
-
set_scale: React.Dispatch<React.SetStateAction<number>>
|
|
39
|
-
val_file: File
|
|
40
|
-
develops: amotify.fn.Cropper.DevelopParams[]
|
|
41
|
-
|
|
42
|
-
use: amotify.fn.Cropper.UseTypes
|
|
43
|
-
componentID: string
|
|
44
|
-
Canvas: {
|
|
45
|
-
elm: HTMLCanvasElement
|
|
46
|
-
ctx: CanvasRenderingContext2D
|
|
47
|
-
}
|
|
48
|
-
Picture: {
|
|
49
|
-
elm: HTMLImageElement
|
|
50
|
-
aspect: number
|
|
51
|
-
originDataUrl: string
|
|
52
|
-
revisedAspect: number
|
|
53
|
-
rotate: number
|
|
54
|
-
grayScale: number
|
|
55
|
-
tone: number
|
|
56
|
-
}
|
|
57
|
-
scale: {
|
|
58
|
-
current: number
|
|
59
|
-
default: number
|
|
60
|
-
min: number,max: number
|
|
61
|
-
}
|
|
62
|
-
pst: {
|
|
63
|
-
frame: {
|
|
64
|
-
x: number,y: number,w: number,h: number,aspect: number
|
|
65
|
-
}
|
|
66
|
-
outImage: {
|
|
67
|
-
x: number,y: number,w: number,h: number
|
|
68
|
-
}
|
|
69
|
-
imageX: number,imageY: number
|
|
70
|
-
centerX: number,centerY: number
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
dragEffectInfo: {
|
|
74
|
-
origin: { x: number,y: number }
|
|
75
|
-
frameExpandRate: { x: number,y: number }
|
|
76
|
-
}
|
|
77
|
-
pinchEffectInfo: {
|
|
78
|
-
origin: {
|
|
79
|
-
x: number,
|
|
80
|
-
y: number,
|
|
81
|
-
scale: number
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
constructor( params: {
|
|
86
|
-
set_scale: React.Dispatch<React.SetStateAction<number>>
|
|
87
|
-
val_file: File
|
|
88
|
-
develops: amotify.fn.Cropper.DevelopParams[]
|
|
89
|
-
scale: {
|
|
90
|
-
default: number
|
|
91
|
-
min: number
|
|
92
|
-
max: number
|
|
93
|
-
}
|
|
94
|
-
picture: {
|
|
95
|
-
image: HTMLImageElement
|
|
96
|
-
grayScale: number
|
|
97
|
-
tone: number
|
|
98
|
-
rotate: number
|
|
99
|
-
}
|
|
100
|
-
use: amotify.fn.Cropper.UseTypes
|
|
101
|
-
componentID: string
|
|
102
|
-
canvas: HTMLCanvasElement
|
|
103
|
-
} ) {
|
|
104
|
-
this.set_scale = params.set_scale
|
|
105
|
-
this.val_file = params.val_file
|
|
106
|
-
this.develops = params.develops
|
|
107
|
-
|
|
108
|
-
this.use = params.use
|
|
109
|
-
this.componentID = params.componentID
|
|
110
|
-
|
|
111
|
-
this.scale = {
|
|
112
|
-
current: params.scale.default,
|
|
113
|
-
default: params.scale.default,
|
|
114
|
-
min: params.scale.min,
|
|
115
|
-
max: params.scale.max
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
let Canvas = params.canvas
|
|
119
|
-
let {
|
|
120
|
-
width: cvsW,
|
|
121
|
-
height: cvsH
|
|
122
|
-
} = Canvas
|
|
123
|
-
|
|
124
|
-
let Picture = params.picture.image
|
|
125
|
-
let {
|
|
126
|
-
width: pictW,
|
|
127
|
-
height: pictH
|
|
128
|
-
} = Picture
|
|
129
|
-
let pictAsp = pictW / pictH
|
|
130
|
-
|
|
131
|
-
this.Canvas = {
|
|
132
|
-
elm: Canvas,
|
|
133
|
-
ctx: Canvas.getContext( '2d' )!
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
let frameW = 0,frameH = 0
|
|
137
|
-
if ( this.use == 'square' ) {
|
|
138
|
-
frameW = Canvas.width / 3 * 2
|
|
139
|
-
frameH = Canvas.height / 3 * 2
|
|
140
|
-
} else if ( this.use == 'wallpaper.horizontal' ) {
|
|
141
|
-
frameW = Canvas.width * ( 7 / 9 )
|
|
142
|
-
frameH = frameW / 3
|
|
143
|
-
} else if ( this.use == 'wallpaper.vertical' ) {
|
|
144
|
-
frameH = Canvas.height * ( 7 / 9 )
|
|
145
|
-
frameW = frameH / 2
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
let frameX = ( Canvas.width - frameW ) / 2
|
|
149
|
-
let frameY = ( Canvas.height - frameH ) / 2
|
|
150
|
-
let frameAsp = frameW / frameH
|
|
151
|
-
|
|
152
|
-
this.Picture = {
|
|
153
|
-
elm: Picture,
|
|
154
|
-
originDataUrl: Picture.src,
|
|
155
|
-
aspect: pictAsp,
|
|
156
|
-
revisedAspect: frameAsp > pictAsp
|
|
157
|
-
? frameW / pictW
|
|
158
|
-
: frameH / pictH,
|
|
159
|
-
rotate: params.picture.rotate,
|
|
160
|
-
grayScale: params.picture.grayScale,
|
|
161
|
-
tone: params.picture.tone
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
this.pst = {
|
|
165
|
-
frame: {
|
|
166
|
-
x: frameX,
|
|
167
|
-
y: frameY,
|
|
168
|
-
w: frameW,
|
|
169
|
-
h: frameH,
|
|
170
|
-
aspect: frameAsp,
|
|
171
|
-
},
|
|
172
|
-
outImage: { x: 0,y: 0,w: 0,h: 0 },
|
|
173
|
-
imageX: pictW / 2,
|
|
174
|
-
imageY: pictH / 2,
|
|
175
|
-
centerX: cvsW / 2,
|
|
176
|
-
centerY: cvsH / 2
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
this.dragEffectInfo = {
|
|
181
|
-
origin: { x: 0,y: 0 },
|
|
182
|
-
frameExpandRate: { x: 0,y: 0 }
|
|
183
|
-
}
|
|
184
|
-
this.pinchEffectInfo = {
|
|
185
|
-
origin: {
|
|
186
|
-
x: 0,y: 0,
|
|
187
|
-
scale: this.scale.current
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
this.modifyImage()
|
|
191
|
-
}
|
|
192
|
-
dragEffect( params: {
|
|
193
|
-
eventType: 'start' | 'move' | 'end'
|
|
194
|
-
x: number
|
|
195
|
-
y: number
|
|
196
|
-
} ) {
|
|
197
|
-
let {
|
|
198
|
-
eventType,x,y
|
|
199
|
-
} = params
|
|
200
|
-
|
|
201
|
-
if ( eventType == 'start' ) {
|
|
202
|
-
let CanvasRect = this.Canvas.elm.position()
|
|
203
|
-
this.dragEffectInfo = {
|
|
204
|
-
origin: { x,y },
|
|
205
|
-
frameExpandRate: {
|
|
206
|
-
x: this.Canvas.elm.width / CanvasRect.width,
|
|
207
|
-
y: this.Canvas.elm.height / CanvasRect.height
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
} else {
|
|
211
|
-
let {
|
|
212
|
-
origin,
|
|
213
|
-
frameExpandRate
|
|
214
|
-
} = this.dragEffectInfo
|
|
215
|
-
let dragX = origin.x - x
|
|
216
|
-
let dragY = origin.y - y
|
|
217
|
-
|
|
218
|
-
let scale = this.scale.current * this.Picture.revisedAspect / 100
|
|
219
|
-
|
|
220
|
-
let shiftX = dragX / scale * frameExpandRate.x
|
|
221
|
-
let shiftY = dragY / scale * frameExpandRate.y
|
|
222
|
-
|
|
223
|
-
if ( eventType == 'move' ) {
|
|
224
|
-
this.drawImage(
|
|
225
|
-
this.pst.imageX + shiftX,
|
|
226
|
-
this.pst.imageY + shiftY,
|
|
227
|
-
)
|
|
228
|
-
} else if ( eventType == 'end' ) {
|
|
229
|
-
this.drawImage(
|
|
230
|
-
this.pst.imageX += shiftX,
|
|
231
|
-
this.pst.imageY += shiftY
|
|
232
|
-
)
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
pinchEffect( params: {
|
|
237
|
-
eventType: 'start' | 'move'
|
|
238
|
-
event: any
|
|
239
|
-
} ) {
|
|
240
|
-
let {
|
|
241
|
-
eventType,
|
|
242
|
-
event
|
|
243
|
-
} = params
|
|
244
|
-
let { x: x1,y: y1 } = $.getCursor( event.touches[ 0 ] )
|
|
245
|
-
let { x: x2,y: y2 } = $.getCursor( event.touches[ 1 ] )
|
|
246
|
-
|
|
247
|
-
let marginX = x2 - x1
|
|
248
|
-
let marginY = y2 - y1
|
|
249
|
-
if ( eventType == 'start' ) {
|
|
250
|
-
|
|
251
|
-
this.pinchEffectInfo.origin = {
|
|
252
|
-
x: marginX,y: marginY,
|
|
253
|
-
scale: this.scale.current
|
|
254
|
-
}
|
|
255
|
-
} else if ( eventType == 'move' ) {
|
|
256
|
-
let {
|
|
257
|
-
origin
|
|
258
|
-
} = this.pinchEffectInfo
|
|
259
|
-
|
|
260
|
-
let originDist = Math.sqrt( Math.pow( origin.x,2 ) + Math.pow( origin.y,2 ) )
|
|
261
|
-
let dist = Math.sqrt( Math.pow( marginX,2 ) + Math.pow( marginY,2 ) )
|
|
262
|
-
let margin = dist / originDist
|
|
263
|
-
|
|
264
|
-
let scale = Number( origin.scale * margin )
|
|
265
|
-
this.set_scale( scale )
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
updateScale( scale: number ) {
|
|
270
|
-
let nextValue = scale
|
|
271
|
-
nextValue = Math.max( nextValue,this.scale.min )
|
|
272
|
-
nextValue = Math.min( nextValue,this.scale.max )
|
|
273
|
-
|
|
274
|
-
this.scale.current = nextValue
|
|
275
|
-
this.drawImage()
|
|
276
|
-
}
|
|
277
|
-
updateFilter( params: {
|
|
278
|
-
grayScale: number
|
|
279
|
-
tone: number
|
|
280
|
-
rotate: number
|
|
281
|
-
} ) {
|
|
282
|
-
this.Picture.grayScale = params.grayScale
|
|
283
|
-
this.Picture.tone = params.tone
|
|
284
|
-
this.Picture.rotate = params.rotate
|
|
285
|
-
this.modifyImage()
|
|
286
|
-
}
|
|
287
|
-
async modifyImage() {
|
|
288
|
-
let {
|
|
289
|
-
grayScale,
|
|
290
|
-
tone,
|
|
291
|
-
rotate
|
|
292
|
-
} = this.Picture
|
|
293
|
-
|
|
294
|
-
const canvas = document.createElement( 'canvas' )
|
|
295
|
-
let ctx = canvas.getContext( '2d' )!
|
|
296
|
-
let image = new Image()
|
|
297
|
-
image.src = this.Picture.originDataUrl
|
|
298
|
-
let ImageW = image.width
|
|
299
|
-
let ImageH = image.height
|
|
300
|
-
|
|
301
|
-
if ( rotate == 90 || rotate == 270 ) {
|
|
302
|
-
ImageW = image.height
|
|
303
|
-
ImageH = image.width
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
canvas.width = ImageW
|
|
307
|
-
canvas.height = ImageH
|
|
308
|
-
|
|
309
|
-
if ( grayScale ) ctx.filter = 'grayscale(' + grayScale + '%)'
|
|
310
|
-
|
|
311
|
-
if ( rotate ) {
|
|
312
|
-
ctx.translate( ImageW / 2,ImageH / 2 )
|
|
313
|
-
ctx.rotate( rotate * Math.PI / 180 )
|
|
314
|
-
if ( [ 90,270 ].includes( rotate ) ) {
|
|
315
|
-
ctx.translate( -ImageH / 2,-ImageW / 2 )
|
|
316
|
-
} else {
|
|
317
|
-
ctx.translate( -ImageW / 2,-ImageH / 2 )
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
ctx.drawImage( image,0,0,image.width,image.height )
|
|
322
|
-
let newImage = ctx.getImageData( 0,0,canvas.width,canvas.height )
|
|
323
|
-
let imgData = newImage.data
|
|
324
|
-
|
|
325
|
-
{
|
|
326
|
-
grayScale /= 100
|
|
327
|
-
|
|
328
|
-
let ColorDir = [
|
|
329
|
-
[ 255,255,255 ], // Original
|
|
330
|
-
[ 255,200,100 ], // Warm
|
|
331
|
-
[ 170,170,255 ], // Cold
|
|
332
|
-
[ 240,200,145 ], // Sepia
|
|
333
|
-
[ 128,255,255 ], // Cyan
|
|
334
|
-
[ 255,128,255 ], // Magenta
|
|
335
|
-
[ 255,255,128 ], // Yellow
|
|
336
|
-
[ 128,158,169 ], // Origin1
|
|
337
|
-
[ 128,112,162 ], // Origin2
|
|
338
|
-
[ 50,192,87 ], // Origin3
|
|
339
|
-
[ 246,100,140 ], // Origin4
|
|
340
|
-
][ tone ]
|
|
341
|
-
let rCorrect = ColorDir[ 0 ] / 255
|
|
342
|
-
let gCorrect = ColorDir[ 1 ] / 255
|
|
343
|
-
let bCorrect = ColorDir[ 2 ] / 255
|
|
344
|
-
|
|
345
|
-
for ( let iH = 0; iH < ImageH; iH++ ) {
|
|
346
|
-
for ( let iW = 0; iW < ImageW; iW++ ) {
|
|
347
|
-
var Index = ( iH * ImageW + iW ) * 4
|
|
348
|
-
|
|
349
|
-
if ( grayScale ) {
|
|
350
|
-
let terminal = 0.3 * imgData[ Index ] + 0.59 * imgData[ Index + 1 ] + 0.11 * imgData[ Index + 2 ]
|
|
351
|
-
for ( var k = 0; k < 3; k++ ) {
|
|
352
|
-
let current = imgData[ Index + k ]
|
|
353
|
-
imgData[ Index + k ] = current + ( terminal - current ) * grayScale
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
imgData[ Index ] *= rCorrect
|
|
358
|
-
imgData[ Index + 1 ] *= gCorrect
|
|
359
|
-
imgData[ Index + 2 ] *= bCorrect
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
ctx.putImageData( newImage,0,0 )
|
|
365
|
-
|
|
366
|
-
let newDataUrl = canvas.toDataURL( 'image/jpeg' )
|
|
367
|
-
|
|
368
|
-
{
|
|
369
|
-
let Picture = await $.ImageLoader( newDataUrl )
|
|
370
|
-
let {
|
|
371
|
-
width: pictW,
|
|
372
|
-
height: pictH
|
|
373
|
-
} = Picture
|
|
374
|
-
let pictAsp = pictW / pictH
|
|
375
|
-
|
|
376
|
-
this.Picture = {
|
|
377
|
-
...this.Picture,
|
|
378
|
-
elm: Picture,
|
|
379
|
-
aspect: pictAsp,
|
|
380
|
-
revisedAspect: this.pst.frame.aspect > pictAsp
|
|
381
|
-
? this.pst.frame.w / pictW
|
|
382
|
-
: this.pst.frame.h / pictH
|
|
383
|
-
}
|
|
384
|
-
// this.pst.imageX = pictW / 2
|
|
385
|
-
// this.pst.imageY = pictH / 2
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
this.drawImage()
|
|
389
|
-
}
|
|
390
|
-
drawImage( _imageX?: number,_imageY?: number ) {
|
|
391
|
-
let {
|
|
392
|
-
use,
|
|
393
|
-
Canvas: {
|
|
394
|
-
ctx
|
|
395
|
-
},
|
|
396
|
-
pst: {
|
|
397
|
-
frame
|
|
398
|
-
}
|
|
399
|
-
} = this
|
|
400
|
-
|
|
401
|
-
let ImageX = _imageX || this.pst.imageX
|
|
402
|
-
let ImageY = _imageY || this.pst.imageY
|
|
403
|
-
|
|
404
|
-
{
|
|
405
|
-
let scale = this.scale.current / 100
|
|
406
|
-
|
|
407
|
-
let totalScale = this.Picture.revisedAspect * scale
|
|
408
|
-
|
|
409
|
-
let imgX = this.pst.centerX - ImageX * totalScale
|
|
410
|
-
let imgY = this.pst.centerY - ImageY * totalScale
|
|
411
|
-
let imgW = this.Picture.elm.width * totalScale
|
|
412
|
-
let imgH = this.Picture.elm.height * totalScale
|
|
413
|
-
|
|
414
|
-
{
|
|
415
|
-
let minX = this.pst.frame.x + this.pst.frame.w - imgW
|
|
416
|
-
let maxX = this.pst.frame.x
|
|
417
|
-
let minY = this.pst.frame.y + this.pst.frame.h - imgH
|
|
418
|
-
let maxY = this.pst.frame.y
|
|
419
|
-
|
|
420
|
-
let extraX = 0
|
|
421
|
-
if ( imgX < minX ) extraX = imgX - minX
|
|
422
|
-
if ( imgX > maxX ) extraX = imgX - maxX
|
|
423
|
-
|
|
424
|
-
let extraY = 0
|
|
425
|
-
if ( imgY < minY ) extraY = imgY - minY
|
|
426
|
-
if ( imgY > maxY ) extraY = imgY - maxY
|
|
427
|
-
|
|
428
|
-
this.dragEffectInfo.origin.x += extraX / 2 / this.dragEffectInfo.frameExpandRate.x
|
|
429
|
-
this.dragEffectInfo.origin.y += extraY / 2 / this.dragEffectInfo.frameExpandRate.y
|
|
430
|
-
|
|
431
|
-
imgX = Math.min( Math.max( imgX,minX ),maxX )
|
|
432
|
-
imgY = Math.min( Math.max( imgY,minY ),maxY )
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
this.pst.outImage = {
|
|
436
|
-
x: imgX,y: imgY,
|
|
437
|
-
w: imgW,h: imgH
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
ctx.clearRect(
|
|
441
|
-
0,
|
|
442
|
-
0,
|
|
443
|
-
this.Canvas.elm.width,
|
|
444
|
-
this.Canvas.elm.height
|
|
445
|
-
)
|
|
446
|
-
|
|
447
|
-
ctx.drawImage(
|
|
448
|
-
this.Picture.elm,
|
|
449
|
-
0,0,this.Picture.elm.width,this.Picture.elm.height,
|
|
450
|
-
|
|
451
|
-
imgX,
|
|
452
|
-
imgY,
|
|
453
|
-
imgW,
|
|
454
|
-
imgH
|
|
455
|
-
)
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
{
|
|
459
|
-
if ( use == 'square' ) {
|
|
460
|
-
ctx.fillStyle = 'rgba( 20,24,20,.3 )'
|
|
461
|
-
ctx.beginPath()
|
|
462
|
-
ctx.arc( this.Canvas.elm.width / 2,this.Canvas.elm.height / 2,this.Canvas.elm.width,0,Math.PI * 2,true )
|
|
463
|
-
ctx.arc( this.Canvas.elm.width / 2,this.Canvas.elm.height / 2,this.Canvas.elm.width / 3 * 2 / 2,0,Math.PI * 2,false )
|
|
464
|
-
ctx.closePath()
|
|
465
|
-
ctx.fill()
|
|
466
|
-
} else if ( use == 'wallpaper.horizontal' ) {
|
|
467
|
-
ctx.fillStyle = 'rgba( 20,24,20,.3 )'
|
|
468
|
-
} else if ( use == 'wallpaper.vertical' ) {
|
|
469
|
-
ctx.fillStyle = 'rgba( 20,24,20,.3 )'
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
ctx.beginPath()
|
|
473
|
-
ctx.moveTo( 0,0 )
|
|
474
|
-
ctx.lineTo( this.Canvas.elm.width,0 )
|
|
475
|
-
ctx.lineTo( this.Canvas.elm.width,this.Canvas.elm.height )
|
|
476
|
-
ctx.lineTo( 0,this.Canvas.elm.height )
|
|
477
|
-
ctx.lineTo( 0,0 )
|
|
478
|
-
ctx.closePath()
|
|
479
|
-
|
|
480
|
-
ctx.lineTo( frame.x,frame.y )
|
|
481
|
-
ctx.lineTo( frame.x,frame.y + frame.h )
|
|
482
|
-
ctx.lineTo( frame.x + frame.w,frame.y + frame.h )
|
|
483
|
-
ctx.lineTo( frame.x + frame.w,frame.y )
|
|
484
|
-
ctx.lineTo( frame.x,frame.y )
|
|
485
|
-
ctx.fill()
|
|
486
|
-
|
|
487
|
-
let body = $( document.body )
|
|
488
|
-
let themeColorHSL = body.getStyleProperty( '--color-theme-hsl' )
|
|
489
|
-
ctx.lineWidth = this.Canvas.elm.width / 200
|
|
490
|
-
ctx.strokeStyle = `hsla( ${ themeColorHSL },1 )`
|
|
491
|
-
ctx.strokeRect( frame.x,frame.y,frame.w,frame.h )
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
async export() {
|
|
495
|
-
let {
|
|
496
|
-
develops,
|
|
497
|
-
Picture,
|
|
498
|
-
pst: {
|
|
499
|
-
outImage,
|
|
500
|
-
frame
|
|
501
|
-
}
|
|
502
|
-
} = this
|
|
503
|
-
|
|
504
|
-
let ratioX = outImage.w / Picture.elm.width
|
|
505
|
-
let ratioY = outImage.h / Picture.elm.height
|
|
506
|
-
|
|
507
|
-
let Left = ( frame.x - outImage.x ) / ratioX
|
|
508
|
-
let Right = ( frame.x - outImage.x + frame.w ) / ratioX
|
|
509
|
-
|
|
510
|
-
let Top = ( frame.y - outImage.y ) / ratioY
|
|
511
|
-
let Bottom = ( frame.y - outImage.y + frame.h ) / ratioY
|
|
512
|
-
|
|
513
|
-
let Files: any = Array.from( { length: develops.length } )
|
|
514
|
-
|
|
515
|
-
let MimeType = 'image/jpeg'
|
|
516
|
-
|
|
517
|
-
for ( let index = 0; index < develops.length; index++ ) {
|
|
518
|
-
let {
|
|
519
|
-
size,maxSize
|
|
520
|
-
} = develops[ index ]
|
|
521
|
-
|
|
522
|
-
maxSize = maxSize || {
|
|
523
|
-
S: 1024 * 20,
|
|
524
|
-
R: 1024 * 100,
|
|
525
|
-
L: 1024 * 350
|
|
526
|
-
}[ size ]
|
|
527
|
-
|
|
528
|
-
let width = {
|
|
529
|
-
S: 144,
|
|
530
|
-
R: 576,
|
|
531
|
-
L: 1152
|
|
532
|
-
}[ size ]
|
|
533
|
-
|
|
534
|
-
let height = width;
|
|
535
|
-
if ( this.use == 'wallpaper.horizontal' ) {
|
|
536
|
-
height = width / 3 * 2
|
|
537
|
-
} else if ( this.use == 'wallpaper.vertical' ) {
|
|
538
|
-
height = width * 2
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
let Preview = document.createElement( 'canvas' )
|
|
542
|
-
Preview.width = width
|
|
543
|
-
Preview.height = height
|
|
544
|
-
|
|
545
|
-
let previewCtx = Preview.getContext( '2d' )
|
|
546
|
-
if ( !previewCtx ) return
|
|
547
|
-
|
|
548
|
-
previewCtx.clearRect( 0,0,width,height )
|
|
549
|
-
previewCtx.drawImage(
|
|
550
|
-
this.Picture.elm,
|
|
551
|
-
Left,
|
|
552
|
-
Top,
|
|
553
|
-
Right - Left,
|
|
554
|
-
Bottom - Top,
|
|
555
|
-
0,0,
|
|
556
|
-
width,
|
|
557
|
-
height
|
|
558
|
-
)
|
|
559
|
-
|
|
560
|
-
let dataUrl = Preview.toDataURL( MimeType )
|
|
561
|
-
let blob = await dataUrl.toBlob( MimeType )
|
|
562
|
-
if ( !blob ) return
|
|
563
|
-
|
|
564
|
-
if ( blob.size >= maxSize ) {
|
|
565
|
-
let Ratio = maxSize / blob.size
|
|
566
|
-
dataUrl = Preview.toDataURL( MimeType,Ratio * 0.92 )
|
|
567
|
-
blob = await dataUrl.toBlob( MimeType )
|
|
568
|
-
if ( !blob ) return
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
let file = new File( [ blob ],this.val_file.name,{ type: MimeType } )
|
|
572
|
-
|
|
573
|
-
Files[ index ] = file
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
return Files
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
const Comps: {
|
|
581
|
-
Core: React.FC<CoreProps>
|
|
582
|
-
SettingRegion: React.FC<{
|
|
583
|
-
DefaultOptions: plainObject
|
|
584
|
-
val_scale: number
|
|
585
|
-
set_scale: React.Dispatch<React.SetStateAction<number>>
|
|
586
|
-
val_tone: number
|
|
587
|
-
set_tone: React.Dispatch<React.SetStateAction<number>>
|
|
588
|
-
val_grayScale: number
|
|
589
|
-
set_grayScale: React.Dispatch<React.SetStateAction<number>>
|
|
590
|
-
val_rotate: number
|
|
591
|
-
set_rotate: React.Dispatch<React.SetStateAction<number>>
|
|
592
|
-
}>
|
|
593
|
-
} = {
|
|
594
|
-
Core: ( params ) => {
|
|
595
|
-
let {
|
|
596
|
-
val_file,
|
|
597
|
-
options,
|
|
598
|
-
finishedCallback,
|
|
599
|
-
abortCallback,
|
|
600
|
-
} = params
|
|
601
|
-
let {
|
|
602
|
-
use,
|
|
603
|
-
develops = []
|
|
604
|
-
} = options
|
|
605
|
-
|
|
606
|
-
let [ val_componentID ] = React.useState( $.uuidGen( 32 ) )
|
|
607
|
-
|
|
608
|
-
const DefaultOptions = {
|
|
609
|
-
scale: {
|
|
610
|
-
default: 125,
|
|
611
|
-
min: 100,
|
|
612
|
-
max: 300
|
|
613
|
-
},
|
|
614
|
-
rotate: 0,
|
|
615
|
-
grayScale: 0,
|
|
616
|
-
tone: 0
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
let [ val_scale,set_scale ] = React.useState( DefaultOptions.scale.default )
|
|
620
|
-
let [ val_rotate,set_rotate ] = React.useState( DefaultOptions.rotate )
|
|
621
|
-
let [ val_grayScale,set_grayScale ] = React.useState( DefaultOptions.grayScale )
|
|
622
|
-
let [ val_tone,set_tone ] = React.useState( DefaultOptions.tone )
|
|
623
|
-
|
|
624
|
-
React.useEffect( () => {
|
|
625
|
-
useStore.set( {
|
|
626
|
-
key: val_componentID,
|
|
627
|
-
value: {}
|
|
628
|
-
} );
|
|
629
|
-
|
|
630
|
-
( async () => {
|
|
631
|
-
amotify.fn.Loader.fn.corner.active()
|
|
632
|
-
|
|
633
|
-
let { target } = await val_file.read()
|
|
634
|
-
if ( !target ) return
|
|
635
|
-
let dataUrl = target!.result as string
|
|
636
|
-
|
|
637
|
-
let Canvas = $( '#Canvas-' + val_componentID )[ 0 ] as HTMLCanvasElement
|
|
638
|
-
if ( !Canvas ) return
|
|
639
|
-
|
|
640
|
-
let __Cropper = new CroppImage( {
|
|
641
|
-
set_scale,
|
|
642
|
-
val_file,
|
|
643
|
-
develops,
|
|
644
|
-
use: use,
|
|
645
|
-
scale: DefaultOptions.scale,
|
|
646
|
-
componentID: val_componentID,
|
|
647
|
-
canvas: Canvas,
|
|
648
|
-
picture: {
|
|
649
|
-
image: await $.ImageLoader( dataUrl ),
|
|
650
|
-
grayScale: DefaultOptions.grayScale,
|
|
651
|
-
tone: DefaultOptions.tone,
|
|
652
|
-
rotate: DefaultOptions.rotate
|
|
653
|
-
}
|
|
654
|
-
} )
|
|
655
|
-
useStore.set( {
|
|
656
|
-
key: val_componentID,
|
|
657
|
-
value: {
|
|
658
|
-
Instance: __Cropper
|
|
659
|
-
}
|
|
660
|
-
} )
|
|
661
|
-
|
|
662
|
-
const UserEffectStart = function ( event: any ) {
|
|
663
|
-
event.preventDefault()
|
|
664
|
-
|
|
665
|
-
if ( event.touches && event.touches.length > 1 ) {
|
|
666
|
-
__Cropper.pinchEffect( {
|
|
667
|
-
eventType: 'start',
|
|
668
|
-
event
|
|
669
|
-
} )
|
|
670
|
-
|
|
671
|
-
$( document )
|
|
672
|
-
.addEvent( {
|
|
673
|
-
eventType: 'touchmove',eventID: 'CropperEffectMove',option: { passive: false },
|
|
674
|
-
callback: ( event ) => {
|
|
675
|
-
event.preventDefault()
|
|
676
|
-
__Cropper.pinchEffect( {
|
|
677
|
-
eventType: 'move',
|
|
678
|
-
event
|
|
679
|
-
} )
|
|
680
|
-
},
|
|
681
|
-
} )
|
|
682
|
-
.addEvent( {
|
|
683
|
-
eventType: 'touchend',eventID: 'CropperEffectEnd',option: { passive: false },
|
|
684
|
-
callback: EventEnd,
|
|
685
|
-
} )
|
|
686
|
-
} else {
|
|
687
|
-
__Cropper.dragEffect( {
|
|
688
|
-
eventType: 'start',
|
|
689
|
-
...$.getCursor( event )
|
|
690
|
-
} )
|
|
691
|
-
|
|
692
|
-
let { type } = event
|
|
693
|
-
|
|
694
|
-
$( document )
|
|
695
|
-
.addEvent( {
|
|
696
|
-
eventType: type == 'touchstart' ? 'touchmove' : 'mousemove',eventID: 'CropperEffectMove',option: { passive: false },
|
|
697
|
-
callback: ( event ) => {
|
|
698
|
-
DragEffect( 'move',event )
|
|
699
|
-
},
|
|
700
|
-
} )
|
|
701
|
-
.addEvent( {
|
|
702
|
-
eventType: type == 'touchstart' ? 'touchend' : 'mouseup',eventID: 'CropperEffectEnd',option: { passive: false },
|
|
703
|
-
callback: ( event ) => {
|
|
704
|
-
DragEffect( 'end',event )
|
|
705
|
-
EventEnd( event )
|
|
706
|
-
},
|
|
707
|
-
} )
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
const DragEffect = function ( eventType: 'move' | 'end',event: any ) {
|
|
711
|
-
event.preventDefault()
|
|
712
|
-
__Cropper.dragEffect( {
|
|
713
|
-
eventType: eventType,
|
|
714
|
-
...$.getCursor( event )
|
|
715
|
-
} )
|
|
716
|
-
}
|
|
717
|
-
const EventEnd = function ( event: any ) {
|
|
718
|
-
event.preventDefault()
|
|
719
|
-
|
|
720
|
-
$( document ).removeEvent( [
|
|
721
|
-
'CropperEffectMove',
|
|
722
|
-
'CropperEffectEnd'
|
|
723
|
-
] )
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
$( Canvas )
|
|
727
|
-
.removeEvent( [
|
|
728
|
-
'CropperMouseWheel',
|
|
729
|
-
'CropperTouchStart',
|
|
730
|
-
'CropperMouseDown'
|
|
731
|
-
] )
|
|
732
|
-
.addEvent( {
|
|
733
|
-
eventID: 'CropperMouseWheel',
|
|
734
|
-
eventType: 'wheel',
|
|
735
|
-
callback: ( event ) => {
|
|
736
|
-
event.preventDefault()
|
|
737
|
-
|
|
738
|
-
let bitScale = Number( event.wheelDelta * 0.04 )
|
|
739
|
-
let nextScale = __Cropper.scale.current + bitScale
|
|
740
|
-
|
|
741
|
-
nextScale = Math.max( nextScale,__Cropper.scale.min )
|
|
742
|
-
nextScale = Math.min( nextScale,__Cropper.scale.max )
|
|
743
|
-
|
|
744
|
-
set_scale( nextScale )
|
|
745
|
-
},
|
|
746
|
-
option: { passive: false }
|
|
747
|
-
} )
|
|
748
|
-
.addEvent( {
|
|
749
|
-
eventType: 'touchstart',eventID: 'CropperTouchStart',
|
|
750
|
-
callback: UserEffectStart,option: { passive: false }
|
|
751
|
-
} )
|
|
752
|
-
.addEvent( {
|
|
753
|
-
eventType: 'mousedown',eventID: 'CropperMouseDown',
|
|
754
|
-
callback: UserEffectStart,option: { passive: false }
|
|
755
|
-
} )
|
|
756
|
-
|
|
757
|
-
setTimeout( () => {
|
|
758
|
-
amotify.fn.Loader.fn.corner.stop()
|
|
759
|
-
},1000 )
|
|
760
|
-
} )()
|
|
761
|
-
},[ val_file.id ] )
|
|
762
|
-
React.useEffect( () => {
|
|
763
|
-
let Instance: CroppImage = useStore.get( val_componentID )?.Instance
|
|
764
|
-
if ( Instance ) {
|
|
765
|
-
Instance.updateScale( val_scale )
|
|
766
|
-
}
|
|
767
|
-
},[ val_scale ] )
|
|
768
|
-
React.useEffect( () => {
|
|
769
|
-
let Instance: CroppImage = useStore.get( val_componentID )?.Instance
|
|
770
|
-
if ( Instance ) {
|
|
771
|
-
Instance.updateFilter( {
|
|
772
|
-
grayScale: val_grayScale,
|
|
773
|
-
tone: val_tone,
|
|
774
|
-
rotate: val_rotate
|
|
775
|
-
} )
|
|
776
|
-
}
|
|
777
|
-
},[ val_grayScale,val_tone,val_rotate ] )
|
|
778
|
-
|
|
779
|
-
return <Sheet.Comps.Body>
|
|
780
|
-
<Flex
|
|
781
|
-
className={ [ style.Wrap,'Use_' + use ].join( ' ' ) }
|
|
782
|
-
flexWrap={ false }
|
|
783
|
-
position='relative'
|
|
784
|
-
overflow={ 'hidden' }
|
|
785
|
-
borderRadius={ 'inherit' }
|
|
786
|
-
boxShadow={ '3.remark' }
|
|
787
|
-
UnderBreakPointStyles={ {
|
|
788
|
-
flexType: 'col'
|
|
789
|
-
} }
|
|
790
|
-
>
|
|
791
|
-
<Box
|
|
792
|
-
flexGrid={ 3 }
|
|
793
|
-
UnderBreakPointStyles={ {
|
|
794
|
-
width: 1,
|
|
795
|
-
padding: 2
|
|
796
|
-
} }
|
|
797
|
-
>
|
|
798
|
-
<Box
|
|
799
|
-
overflow='hidden'
|
|
800
|
-
position='relative'
|
|
801
|
-
backgroundColor={ '4.layer.darken' }
|
|
802
|
-
freeCSS={ {
|
|
803
|
-
zIndex: 1
|
|
804
|
-
} }
|
|
805
|
-
UnderBreakPointStyles={ {
|
|
806
|
-
borderRadius: '1.tone.primary'
|
|
807
|
-
} }
|
|
808
|
-
>
|
|
809
|
-
<canvas
|
|
810
|
-
width={ '2400' }
|
|
811
|
-
height={
|
|
812
|
-
use == 'wallpaper.horizontal' ? '1800'
|
|
813
|
-
: use == 'wallpaper.vertical' ? '3200'
|
|
814
|
-
: '2400'
|
|
815
|
-
}
|
|
816
|
-
className={ style.Canvas }
|
|
817
|
-
id={ 'Canvas-' + val_componentID }
|
|
818
|
-
/>
|
|
819
|
-
</Box>
|
|
820
|
-
</Box>
|
|
821
|
-
<Column
|
|
822
|
-
gap={ 0 }
|
|
823
|
-
flexGrid={ 2 }
|
|
824
|
-
boxShadow={ '3.remark' }
|
|
825
|
-
UnderBreakPointStyles={ {
|
|
826
|
-
width: 1,
|
|
827
|
-
maxWidth: 'unset'
|
|
828
|
-
} }
|
|
829
|
-
freeCSS={ {
|
|
830
|
-
maxWidth: 12 * 28
|
|
831
|
-
} }
|
|
832
|
-
>
|
|
833
|
-
<Column
|
|
834
|
-
gap={ 1 }
|
|
835
|
-
flexSizing={ 0 }
|
|
836
|
-
overflow='auto'
|
|
837
|
-
padding={ 1.5 }
|
|
838
|
-
UnderBreakPointStyles={ {
|
|
839
|
-
flexSizing: 'none'
|
|
840
|
-
} }
|
|
841
|
-
>
|
|
842
|
-
<Box
|
|
843
|
-
flexSizing='none'
|
|
844
|
-
fontSize='4.thirdTitle'
|
|
845
|
-
isSemiBoldFont
|
|
846
|
-
>
|
|
847
|
-
フィルター
|
|
848
|
-
</Box>
|
|
849
|
-
<Comps.SettingRegion
|
|
850
|
-
DefaultOptions={ DefaultOptions }
|
|
851
|
-
val_scale={ val_scale }
|
|
852
|
-
set_scale={ set_scale }
|
|
853
|
-
val_tone={ val_tone }
|
|
854
|
-
set_tone={ set_tone }
|
|
855
|
-
val_grayScale={ val_grayScale }
|
|
856
|
-
set_grayScale={ set_grayScale }
|
|
857
|
-
val_rotate={ val_rotate }
|
|
858
|
-
set_rotate={ set_rotate }
|
|
859
|
-
/>
|
|
860
|
-
</Column>
|
|
861
|
-
<Flex
|
|
862
|
-
padding={ 1.5 }
|
|
863
|
-
flexSizing={ 'none' }
|
|
864
|
-
gap={ 1 }
|
|
865
|
-
borderTop
|
|
866
|
-
>
|
|
867
|
-
<Buttons.Button.Border.R
|
|
868
|
-
flexGrid={ 1 }
|
|
869
|
-
onClick={ () => {
|
|
870
|
-
abortCallback()
|
|
871
|
-
} }
|
|
872
|
-
>
|
|
873
|
-
キャンセル
|
|
874
|
-
</Buttons.Button.Border.R>
|
|
875
|
-
<Buttons.Button.Prime.R
|
|
876
|
-
flexGrid={ 2 }
|
|
877
|
-
onClick={ async () => {
|
|
878
|
-
let Instance: CroppImage = useStore.get( val_componentID )?.Instance
|
|
879
|
-
if ( !Instance ) return
|
|
880
|
-
amotify.fn.Loader.fn.mini.active( 'CropperExportation' )
|
|
881
|
-
let Files = await Instance.export()
|
|
882
|
-
|
|
883
|
-
setTimeout( () => {
|
|
884
|
-
amotify.fn.Loader.fn.mini.stop( 'CropperExportation' )
|
|
885
|
-
finishedCallback( Files )
|
|
886
|
-
},3000 )
|
|
887
|
-
} }
|
|
888
|
-
>
|
|
889
|
-
<Row.Center
|
|
890
|
-
gap={ '1/2' }
|
|
891
|
-
>
|
|
892
|
-
<Loader.White.R
|
|
893
|
-
loaderID='CropperExportation'
|
|
894
|
-
/>
|
|
895
|
-
決定
|
|
896
|
-
</Row.Center>
|
|
897
|
-
</Buttons.Button.Prime.R>
|
|
898
|
-
</Flex>
|
|
899
|
-
</Column>
|
|
900
|
-
</Flex>
|
|
901
|
-
</Sheet.Comps.Body>
|
|
902
|
-
},
|
|
903
|
-
SettingRegion: ( params ) => {
|
|
904
|
-
let ToneList: amotify.fn.Input.List.OptionParams[] = []
|
|
905
|
-
for ( let index = 1; index <= 10; index++ ) {
|
|
906
|
-
ToneList.push( {
|
|
907
|
-
value: index,
|
|
908
|
-
label: <>
|
|
909
|
-
<Box
|
|
910
|
-
className={ [
|
|
911
|
-
style.ToneBall,
|
|
912
|
-
style[ 'ToneBall_' + index ]
|
|
913
|
-
].join( ' ' ) }
|
|
914
|
-
/>
|
|
915
|
-
<Box
|
|
916
|
-
textAlign='center'
|
|
917
|
-
flexSizing={ 'auto' }
|
|
918
|
-
>
|
|
919
|
-
{ [ '','暖色','寒色','セピア','シアン','マゼンタ','イエロー','オリジナル1','オリジナル2','オリジナル3','オリジナル4' ][ index ] }
|
|
920
|
-
</Box>
|
|
921
|
-
</>
|
|
922
|
-
} )
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
return <>
|
|
926
|
-
<Column gap={ '1/3' } >
|
|
927
|
-
<Box>
|
|
928
|
-
<FAI.Rotate
|
|
929
|
-
fontSize='3.paragraph'
|
|
930
|
-
fontColor='4.thin'
|
|
931
|
-
/> Rotate
|
|
932
|
-
</Box>
|
|
933
|
-
<Row.Separate
|
|
934
|
-
flexChilds='even'
|
|
935
|
-
paddingLeft={ 2 }
|
|
936
|
-
>
|
|
937
|
-
<Buttons.Button.Border.S
|
|
938
|
-
onClick={ () => {
|
|
939
|
-
let next = params.val_rotate - 90
|
|
940
|
-
if ( next < 0 ) next += 360
|
|
941
|
-
params.set_rotate( next )
|
|
942
|
-
} }
|
|
943
|
-
>
|
|
944
|
-
<FAI icon={ faRotateLeft } /> 左に回転
|
|
945
|
-
</Buttons.Button.Border.S>
|
|
946
|
-
<Buttons.Button.Border.S
|
|
947
|
-
onClick={ () => {
|
|
948
|
-
params.set_rotate( ( params.val_rotate + 90 ) % 360 )
|
|
949
|
-
} }
|
|
950
|
-
>
|
|
951
|
-
右に回転 <FAI icon={ faRotateRight } />
|
|
952
|
-
</Buttons.Button.Border.S>
|
|
953
|
-
</Row.Separate>
|
|
954
|
-
</Column>
|
|
955
|
-
<Column gap={ '1/3' } >
|
|
956
|
-
<Box>
|
|
957
|
-
<FAI.Search
|
|
958
|
-
fontSize='3.paragraph'
|
|
959
|
-
fontColor='4.thin'
|
|
960
|
-
/> Zoom
|
|
961
|
-
</Box>
|
|
962
|
-
<Box paddingLeft={ 2 }>
|
|
963
|
-
<Input.Slider
|
|
964
|
-
override='force'
|
|
965
|
-
value={ params.val_scale - 100 }
|
|
966
|
-
min={ params.DefaultOptions.scale.min - 100 }
|
|
967
|
-
max={ params.DefaultOptions.scale.max - 100 }
|
|
968
|
-
step={ 25 }
|
|
969
|
-
onUpdateValidValue={ ( { eventType,value } ) => {
|
|
970
|
-
$.interval.clear( 'Cropper.UpdateScale' )
|
|
971
|
-
$.interval.standBy( 'Cropper.UpdateScale',400,() => {
|
|
972
|
-
params.set_scale( value + 100 )
|
|
973
|
-
} )
|
|
974
|
-
} }
|
|
975
|
-
legends={ {
|
|
976
|
-
enable: true,
|
|
977
|
-
custom: ( value ) => {
|
|
978
|
-
let scale = Math.round( 100 + value )
|
|
979
|
-
return 'x' + scale / 100
|
|
980
|
-
}
|
|
981
|
-
} }
|
|
982
|
-
/>
|
|
983
|
-
</Box>
|
|
984
|
-
</Column>
|
|
985
|
-
<Column gap={ '1/3' } >
|
|
986
|
-
<Box>
|
|
987
|
-
<FAI
|
|
988
|
-
icon={ faPalette }
|
|
989
|
-
fontSize='3.paragraph'
|
|
990
|
-
fontColor='4.thin'
|
|
991
|
-
/> Gray Scale
|
|
992
|
-
</Box>
|
|
993
|
-
<Box paddingLeft={ 2 }>
|
|
994
|
-
<Input.Slider
|
|
995
|
-
value={ params.val_grayScale }
|
|
996
|
-
min={ 0 }
|
|
997
|
-
max={ 100 }
|
|
998
|
-
step={ 10 }
|
|
999
|
-
onUpdateValidValue={ ( { value } ) => {
|
|
1000
|
-
$.interval.clear( 'Cropper.GrayScale' )
|
|
1001
|
-
$.interval.standBy( 'Cropper.GrayScale',400,() => {
|
|
1002
|
-
params.set_grayScale( value )
|
|
1003
|
-
} )
|
|
1004
|
-
} }
|
|
1005
|
-
legends={ {
|
|
1006
|
-
enable: true,
|
|
1007
|
-
custom: ( value ) => ( value + '%' )
|
|
1008
|
-
} }
|
|
1009
|
-
/>
|
|
1010
|
-
</Box>
|
|
1011
|
-
</Column>
|
|
1012
|
-
<Column gap={ '1/3' }>
|
|
1013
|
-
<Box>
|
|
1014
|
-
<FAI
|
|
1015
|
-
icon={ faBarsStaggered }
|
|
1016
|
-
fontSize='3.paragraph'
|
|
1017
|
-
fontColor='4.thin'
|
|
1018
|
-
/> Tone
|
|
1019
|
-
</Box>
|
|
1020
|
-
<Box paddingLeft={ 2 }>
|
|
1021
|
-
<Input.Radio
|
|
1022
|
-
value={ params.val_tone }
|
|
1023
|
-
gap={ '1/2' }
|
|
1024
|
-
cellStyles={ {
|
|
1025
|
-
isRounded: true,
|
|
1026
|
-
borderWidth: 2,
|
|
1027
|
-
borderColor: '1.thin',
|
|
1028
|
-
padding: '1/2',
|
|
1029
|
-
paddingRight: 1,
|
|
1030
|
-
fontSize: '1.mini',
|
|
1031
|
-
gap: '1/3',
|
|
1032
|
-
flexSizing: 'auto'
|
|
1033
|
-
} }
|
|
1034
|
-
options={ [
|
|
1035
|
-
{
|
|
1036
|
-
value: 0,label: 'なし',
|
|
1037
|
-
padding: [ '1/2',1 ],
|
|
1038
|
-
flexCenter: true
|
|
1039
|
-
},
|
|
1040
|
-
...ToneList
|
|
1041
|
-
] }
|
|
1042
|
-
onUpdateValidValue={ ( { value } ) => {
|
|
1043
|
-
params.set_tone( value[ 0 ] )
|
|
1044
|
-
} }
|
|
1045
|
-
/>
|
|
1046
|
-
</Box>
|
|
1047
|
-
</Column>
|
|
1048
|
-
</>
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
export const Cropper: amotify.fn.Cropper.Methods = {
|
|
1053
|
-
open: async ( params ) => {
|
|
1054
|
-
let Image = await Input.File.fn.openDialog( {
|
|
1055
|
-
// accept: 'image/jpeg,image/jpg,image/png,image/gif',
|
|
1056
|
-
accept: 'image',
|
|
1057
|
-
multiple: false
|
|
1058
|
-
} )
|
|
1059
|
-
|
|
1060
|
-
let sheetID = 'CropperImage'
|
|
1061
|
-
amotify.fn.Sheet.open( {
|
|
1062
|
-
sheetID: sheetID,
|
|
1063
|
-
type: 'normal.middleCenter',
|
|
1064
|
-
size: '3L',
|
|
1065
|
-
freeCSS: {
|
|
1066
|
-
width: params.use == 'wallpaper.horizontal' ? 12 * 100 : 12 * 80
|
|
1067
|
-
},
|
|
1068
|
-
content: <Comps.Core
|
|
1069
|
-
val_file={ Image[ 0 ] as any }
|
|
1070
|
-
options={ params }
|
|
1071
|
-
finishedCallback={ ( files ) => {
|
|
1072
|
-
amotify.fn.Sheet.close( sheetID )
|
|
1073
|
-
params.onProcessFinished( files )
|
|
1074
|
-
} }
|
|
1075
|
-
abortCallback={ () => {
|
|
1076
|
-
amotify.fn.Sheet.close( sheetID )
|
|
1077
|
-
} }
|
|
1078
|
-
/>,
|
|
1079
|
-
close_option: {
|
|
1080
|
-
escapeKeyDown: false
|
|
1081
|
-
}
|
|
1082
|
-
} )
|
|
1083
|
-
}
|
|
1084
|
-
}
|