amotify 0.0.59 → 0.0.62
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/@types/_.tsx +5 -5
- package/@types/amot.tsx +11 -11
- package/@types/fn.tsx +14 -1
- package/@types/module.tsx +1 -1
- package/dist/amotify.js +1 -1
- package/dist/amotify.min.css +3 -3
- package/package.json +1 -1
- package/src/@atoms.tsx +3 -3
- package/src/@functions.tsx +11 -11
- package/src/@global.tsx +40 -40
- package/src/@jsminAmotifyExtension/_.tsx +4 -4
- package/src/@jsminAmotifyExtension/fetch.tsx +30 -30
- package/src/@jsminAmotifyExtension/formCollect.tsx +32 -32
- package/src/@jsminAmotifyExtension/spreadSheet.tsx +71 -71
- package/src/@jsminAmotifyExtension/variables.tsx +38 -38
- package/src/@molecules.tsx +6 -6
- package/src/@styles/props.scss +1 -1
- package/src/@styles/var.scss +0 -1
- package/src/@templates.tsx +1 -1
- package/src/@variables.tsx +2 -2
- package/src/atoms/FAI/parts.tsx +105 -105
- package/src/atoms/Logo/parts.tsx +19 -19
- package/src/atoms/Various/parts.tsx +26 -26
- package/src/config.tsx +62 -59
- package/src/functions/Button/_.tsx +49 -49
- package/src/functions/Cropper/parts.tsx +249 -249
- package/src/functions/Effects/Fade.tsx +18 -18
- package/src/functions/Effects/Ripple.tsx +24 -24
- package/src/functions/Effects/_.tsx +5 -5
- package/src/functions/Input/Chips/Selector.tsx +107 -107
- package/src/functions/Input/Chips/_.tsx +66 -66
- package/src/functions/Input/Contenteditable.tsx +18 -18
- package/src/functions/Input/DigitCharacters.tsx +48 -48
- package/src/functions/Input/File/_.tsx +114 -114
- package/src/functions/Input/Hidden.tsx +3 -3
- package/src/functions/Input/List/_.tsx +61 -61
- package/src/functions/Input/RichSelect/_.tsx +38 -38
- package/src/functions/Input/Segmented/_.tsx +30 -30
- package/src/functions/Input/Select/_.tsx +42 -42
- package/src/functions/Input/Slider/_.tsx +93 -93
- package/src/functions/Input/Switch/_.tsx +21 -21
- package/src/functions/Input/Text.tsx +99 -97
- package/src/functions/Input/TextArea.tsx +17 -17
- package/src/functions/Input/Time/Picker.tsx +199 -199
- package/src/functions/Input/Time/_.tsx +173 -173
- package/src/functions/Input/_.tsx +135 -135
- package/src/functions/Input/core.tsx +96 -96
- package/src/functions/Inputs/_.tsx +1 -1
- package/src/functions/Inputs/text.tsx +5 -5
- package/src/functions/Layout/PageNotFound.tsx +6 -6
- package/src/functions/Layout/PageRouter.tsx +28 -44
- package/src/functions/Layout/PageViewController/parts.tsx +7 -7
- package/src/functions/Layout/Plate.tsx +5 -5
- package/src/functions/Layout/RootViewController/parts.tsx +94 -71
- package/src/functions/Layout/RootViewController/style.module.scss +0 -1
- package/src/functions/Layout/SwipeView/parts.tsx +90 -90
- package/src/functions/Layout/TabBar.tsx +10 -10
- package/src/functions/Layout/_.tsx +7 -7
- package/src/functions/Loader/corner.tsx +10 -10
- package/src/functions/Loader/mini.tsx +25 -25
- package/src/functions/Loader/parts.tsx +31 -31
- package/src/functions/Loader/top.tsx +10 -10
- package/src/functions/Sheet/parts.tsx +219 -219
- package/src/functions/Sheet/style.module.scss +0 -20
- package/src/functions/SnackBar/parts.tsx +50 -50
- package/src/functions/Table/Data/parts.tsx +202 -202
- package/src/functions/Table/Drag/parts.tsx +76 -76
- package/src/functions/Table/Normal/parts.tsx +23 -23
- package/src/functions/Table/_.tsx +33 -33
- package/src/functions/Tooltips/parts.tsx +7 -7
- package/src/global/LaunchReactApplication.tsx +28 -28
- package/src/global/styleConverter.tsx +133 -133
- package/src/launch.tsx +27 -27
- package/src/molecules/Accordion/parts.tsx +41 -41
- package/src/molecules/LinkifyText/parts.tsx +18 -18
- package/src/molecules/List.tsx +6 -6
- package/src/preload.tsx +5 -45
- package/src/templates/PlayGround/parts.tsx +8 -8
- package/webpack.config.js +9 -9
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useStore,
|
|
3
3
|
React
|
|
4
|
-
} from '@global'
|
|
4
|
+
} from '@global'
|
|
5
5
|
import {
|
|
6
6
|
Box,
|
|
7
7
|
Flex,
|
|
8
8
|
FAI
|
|
9
|
-
} from '@atoms'
|
|
9
|
+
} from '@atoms'
|
|
10
10
|
import {
|
|
11
11
|
Column,
|
|
12
12
|
Row,
|
|
13
13
|
Text
|
|
14
|
-
} from '@mols'
|
|
14
|
+
} from '@mols'
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
17
|
Buttons,
|
|
18
18
|
Input,
|
|
19
19
|
Sheet,
|
|
20
20
|
Loader
|
|
21
|
-
} from '@fn'
|
|
21
|
+
} from '@fn'
|
|
22
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'
|
|
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
27
|
|
|
28
|
-
import style from './style.module.scss'
|
|
28
|
+
import style from './style.module.scss'
|
|
29
29
|
|
|
30
30
|
type CoreProps = {
|
|
31
31
|
val_file: amotify.fn.Input.Filer.CustomFile
|
|
@@ -101,12 +101,12 @@ class CroppImage {
|
|
|
101
101
|
componentID: string
|
|
102
102
|
canvas: HTMLCanvasElement
|
|
103
103
|
} ) {
|
|
104
|
-
this.set_scale = params.set_scale
|
|
105
|
-
this.val_file = params.val_file
|
|
106
|
-
this.develops = params.develops
|
|
104
|
+
this.set_scale = params.set_scale
|
|
105
|
+
this.val_file = params.val_file
|
|
106
|
+
this.develops = params.develops
|
|
107
107
|
|
|
108
|
-
this.use = params.use
|
|
109
|
-
this.componentID = params.componentID
|
|
108
|
+
this.use = params.use
|
|
109
|
+
this.componentID = params.componentID
|
|
110
110
|
|
|
111
111
|
this.scale = {
|
|
112
112
|
current: params.scale.default,
|
|
@@ -115,35 +115,35 @@ class CroppImage {
|
|
|
115
115
|
max: params.scale.max
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
let Canvas = params.canvas
|
|
118
|
+
let Canvas = params.canvas
|
|
119
119
|
let {
|
|
120
120
|
width: cvsW,
|
|
121
121
|
height: cvsH
|
|
122
|
-
} = Canvas
|
|
122
|
+
} = Canvas
|
|
123
123
|
|
|
124
|
-
let Picture = params.picture.image
|
|
124
|
+
let Picture = params.picture.image
|
|
125
125
|
let {
|
|
126
126
|
width: pictW,
|
|
127
127
|
height: pictH
|
|
128
|
-
} = Picture
|
|
129
|
-
let pictAsp = pictW / pictH
|
|
128
|
+
} = Picture
|
|
129
|
+
let pictAsp = pictW / pictH
|
|
130
130
|
|
|
131
131
|
this.Canvas = {
|
|
132
132
|
elm: Canvas,
|
|
133
133
|
ctx: Canvas.getContext( '2d' )!
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
let frameW = 0,frameH = 0
|
|
136
|
+
let frameW = 0,frameH = 0
|
|
137
137
|
if ( this.use == 'profile' ) {
|
|
138
|
-
frameW = Canvas.width / 3 * 2
|
|
139
|
-
frameH = Canvas.height / 3 * 2
|
|
138
|
+
frameW = Canvas.width / 3 * 2
|
|
139
|
+
frameH = Canvas.height / 3 * 2
|
|
140
140
|
} else if ( this.use == 'header' ) {
|
|
141
|
-
frameW = Canvas.width * ( 7 / 9 )
|
|
142
|
-
frameH = frameW / 3
|
|
141
|
+
frameW = Canvas.width * ( 7 / 9 )
|
|
142
|
+
frameH = frameW / 3
|
|
143
143
|
}
|
|
144
|
-
let frameX = ( Canvas.width - frameW ) / 2
|
|
145
|
-
let frameY = ( Canvas.height - frameH ) / 2
|
|
146
|
-
let frameAsp = frameW / frameH
|
|
144
|
+
let frameX = ( Canvas.width - frameW ) / 2
|
|
145
|
+
let frameY = ( Canvas.height - frameH ) / 2
|
|
146
|
+
let frameAsp = frameW / frameH
|
|
147
147
|
|
|
148
148
|
this.Picture = {
|
|
149
149
|
elm: Picture,
|
|
@@ -183,7 +183,7 @@ class CroppImage {
|
|
|
183
183
|
scale: this.scale.current
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
this.modifyImage()
|
|
186
|
+
this.modifyImage()
|
|
187
187
|
}
|
|
188
188
|
dragEffect( params: {
|
|
189
189
|
eventType: 'start' | 'move' | 'end'
|
|
@@ -192,10 +192,10 @@ class CroppImage {
|
|
|
192
192
|
} ) {
|
|
193
193
|
let {
|
|
194
194
|
eventType,x,y
|
|
195
|
-
} = params
|
|
195
|
+
} = params
|
|
196
196
|
|
|
197
197
|
if ( eventType == 'start' ) {
|
|
198
|
-
let CanvasRect = this.Canvas.elm.position()
|
|
198
|
+
let CanvasRect = this.Canvas.elm.position()
|
|
199
199
|
this.dragEffectInfo = {
|
|
200
200
|
origin: { x,y },
|
|
201
201
|
frameExpandRate: {
|
|
@@ -207,20 +207,20 @@ class CroppImage {
|
|
|
207
207
|
let {
|
|
208
208
|
origin,
|
|
209
209
|
frameExpandRate
|
|
210
|
-
} = this.dragEffectInfo
|
|
211
|
-
let dragX = origin.x - x
|
|
212
|
-
let dragY = origin.y - y
|
|
210
|
+
} = this.dragEffectInfo
|
|
211
|
+
let dragX = origin.x - x
|
|
212
|
+
let dragY = origin.y - y
|
|
213
213
|
|
|
214
|
-
let scale = this.scale.current * this.Picture.revisedAspect / 100
|
|
214
|
+
let scale = this.scale.current * this.Picture.revisedAspect / 100
|
|
215
215
|
|
|
216
|
-
let shiftX = dragX / scale * frameExpandRate.x
|
|
217
|
-
let shiftY = dragY / scale * frameExpandRate.y
|
|
216
|
+
let shiftX = dragX / scale * frameExpandRate.x
|
|
217
|
+
let shiftY = dragY / scale * frameExpandRate.y
|
|
218
218
|
|
|
219
219
|
if ( eventType == 'move' ) {
|
|
220
220
|
this.drawImage(
|
|
221
221
|
this.pst.imageX + shiftX,
|
|
222
222
|
this.pst.imageY + shiftY,
|
|
223
|
-
)
|
|
223
|
+
)
|
|
224
224
|
} else if ( eventType == 'end' ) {
|
|
225
225
|
this.drawImage(
|
|
226
226
|
this.pst.imageX += shiftX,
|
|
@@ -236,12 +236,12 @@ class CroppImage {
|
|
|
236
236
|
let {
|
|
237
237
|
eventType,
|
|
238
238
|
event
|
|
239
|
-
} = params
|
|
240
|
-
let { x: x1,y: y1 } = $.getCursor( event.touches[ 0 ] )
|
|
241
|
-
let { x: x2,y: y2 } = $.getCursor( event.touches[ 1 ] )
|
|
239
|
+
} = params
|
|
240
|
+
let { x: x1,y: y1 } = $.getCursor( event.touches[ 0 ] )
|
|
241
|
+
let { x: x2,y: y2 } = $.getCursor( event.touches[ 1 ] )
|
|
242
242
|
|
|
243
|
-
let marginX = x2 - x1
|
|
244
|
-
let marginY = y2 - y1
|
|
243
|
+
let marginX = x2 - x1
|
|
244
|
+
let marginY = y2 - y1
|
|
245
245
|
if ( eventType == 'start' ) {
|
|
246
246
|
|
|
247
247
|
this.pinchEffectInfo.origin = {
|
|
@@ -251,75 +251,75 @@ class CroppImage {
|
|
|
251
251
|
} else if ( eventType == 'move' ) {
|
|
252
252
|
let {
|
|
253
253
|
origin
|
|
254
|
-
} = this.pinchEffectInfo
|
|
254
|
+
} = this.pinchEffectInfo
|
|
255
255
|
|
|
256
|
-
let originDist = Math.sqrt( Math.pow( origin.x,2 ) + Math.pow( origin.y,2 ) )
|
|
257
|
-
let dist = Math.sqrt( Math.pow( marginX,2 ) + Math.pow( marginY,2 ) )
|
|
258
|
-
let margin = dist / originDist
|
|
256
|
+
let originDist = Math.sqrt( Math.pow( origin.x,2 ) + Math.pow( origin.y,2 ) )
|
|
257
|
+
let dist = Math.sqrt( Math.pow( marginX,2 ) + Math.pow( marginY,2 ) )
|
|
258
|
+
let margin = dist / originDist
|
|
259
259
|
|
|
260
|
-
let scale = Number( origin.scale * margin )
|
|
261
|
-
this.set_scale( scale )
|
|
260
|
+
let scale = Number( origin.scale * margin )
|
|
261
|
+
this.set_scale( scale )
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
updateScale( scale: number ) {
|
|
266
|
-
let nextValue = scale
|
|
267
|
-
nextValue = Math.max( nextValue,this.scale.min )
|
|
268
|
-
nextValue = Math.min( nextValue,this.scale.max )
|
|
266
|
+
let nextValue = scale
|
|
267
|
+
nextValue = Math.max( nextValue,this.scale.min )
|
|
268
|
+
nextValue = Math.min( nextValue,this.scale.max )
|
|
269
269
|
|
|
270
|
-
this.scale.current = nextValue
|
|
271
|
-
this.drawImage()
|
|
270
|
+
this.scale.current = nextValue
|
|
271
|
+
this.drawImage()
|
|
272
272
|
}
|
|
273
273
|
updateFilter( params: {
|
|
274
274
|
grayScale: number
|
|
275
275
|
tone: number
|
|
276
276
|
rotate: number
|
|
277
277
|
} ) {
|
|
278
|
-
this.Picture.grayScale = params.grayScale
|
|
279
|
-
this.Picture.tone = params.tone
|
|
280
|
-
this.Picture.rotate = params.rotate
|
|
281
|
-
this.modifyImage()
|
|
278
|
+
this.Picture.grayScale = params.grayScale
|
|
279
|
+
this.Picture.tone = params.tone
|
|
280
|
+
this.Picture.rotate = params.rotate
|
|
281
|
+
this.modifyImage()
|
|
282
282
|
}
|
|
283
283
|
async modifyImage() {
|
|
284
284
|
let {
|
|
285
285
|
grayScale,
|
|
286
286
|
tone,
|
|
287
287
|
rotate
|
|
288
|
-
} = this.Picture
|
|
288
|
+
} = this.Picture
|
|
289
289
|
|
|
290
|
-
const canvas = document.createElement( 'canvas' )
|
|
291
|
-
let ctx = canvas.getContext( '2d' )
|
|
292
|
-
let image = new Image()
|
|
293
|
-
image.src = this.Picture.originDataUrl
|
|
294
|
-
let ImageW = image.width
|
|
295
|
-
let ImageH = image.height
|
|
290
|
+
const canvas = document.createElement( 'canvas' )
|
|
291
|
+
let ctx = canvas.getContext( '2d' )!
|
|
292
|
+
let image = new Image()
|
|
293
|
+
image.src = this.Picture.originDataUrl
|
|
294
|
+
let ImageW = image.width
|
|
295
|
+
let ImageH = image.height
|
|
296
296
|
|
|
297
297
|
if ( rotate == 90 || rotate == 270 ) {
|
|
298
|
-
ImageW = image.height
|
|
299
|
-
ImageH = image.width
|
|
298
|
+
ImageW = image.height
|
|
299
|
+
ImageH = image.width
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
canvas.width = ImageW
|
|
303
|
-
canvas.height = ImageH
|
|
302
|
+
canvas.width = ImageW
|
|
303
|
+
canvas.height = ImageH
|
|
304
304
|
|
|
305
|
-
if ( grayScale ) ctx.filter = 'grayscale(' + grayScale + '%)'
|
|
305
|
+
if ( grayScale ) ctx.filter = 'grayscale(' + grayScale + '%)'
|
|
306
306
|
|
|
307
307
|
if ( rotate ) {
|
|
308
|
-
ctx.translate( ImageW / 2,ImageH / 2 )
|
|
309
|
-
ctx.rotate( rotate * Math.PI / 180 )
|
|
308
|
+
ctx.translate( ImageW / 2,ImageH / 2 )
|
|
309
|
+
ctx.rotate( rotate * Math.PI / 180 )
|
|
310
310
|
if ( [ 90,270 ].includes( rotate ) ) {
|
|
311
|
-
ctx.translate( -ImageH / 2,-ImageW / 2 )
|
|
311
|
+
ctx.translate( -ImageH / 2,-ImageW / 2 )
|
|
312
312
|
} else {
|
|
313
|
-
ctx.translate( -ImageW / 2,-ImageH / 2 )
|
|
313
|
+
ctx.translate( -ImageW / 2,-ImageH / 2 )
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
ctx.drawImage( image,0,0,image.width,image.height )
|
|
318
|
-
let newImage = ctx.getImageData( 0,0,canvas.width,canvas.height )
|
|
319
|
-
let imgData = newImage.data
|
|
317
|
+
ctx.drawImage( image,0,0,image.width,image.height )
|
|
318
|
+
let newImage = ctx.getImageData( 0,0,canvas.width,canvas.height )
|
|
319
|
+
let imgData = newImage.data
|
|
320
320
|
|
|
321
321
|
{
|
|
322
|
-
grayScale /= 100
|
|
322
|
+
grayScale /= 100
|
|
323
323
|
|
|
324
324
|
let ColorDir = [
|
|
325
325
|
[ 255,255,255 ], // Original
|
|
@@ -333,41 +333,41 @@ class CroppImage {
|
|
|
333
333
|
[ 128,112,162 ], // Origin2
|
|
334
334
|
[ 50,192,87 ], // Origin3
|
|
335
335
|
[ 246,100,140 ], // Origin4
|
|
336
|
-
][ tone ]
|
|
337
|
-
let rCorrect = ColorDir[ 0 ] / 255
|
|
338
|
-
let gCorrect = ColorDir[ 1 ] / 255
|
|
339
|
-
let bCorrect = ColorDir[ 2 ] / 255
|
|
336
|
+
][ tone ]
|
|
337
|
+
let rCorrect = ColorDir[ 0 ] / 255
|
|
338
|
+
let gCorrect = ColorDir[ 1 ] / 255
|
|
339
|
+
let bCorrect = ColorDir[ 2 ] / 255
|
|
340
340
|
|
|
341
341
|
for ( let iH = 0; iH < ImageH; iH++ ) {
|
|
342
342
|
for ( let iW = 0; iW < ImageW; iW++ ) {
|
|
343
|
-
var Index = ( iH * ImageW + iW ) * 4
|
|
343
|
+
var Index = ( iH * ImageW + iW ) * 4
|
|
344
344
|
|
|
345
345
|
if ( grayScale ) {
|
|
346
|
-
let terminal = 0.3 * imgData[ Index ] + 0.59 * imgData[ Index + 1 ] + 0.11 * imgData[ Index + 2 ]
|
|
346
|
+
let terminal = 0.3 * imgData[ Index ] + 0.59 * imgData[ Index + 1 ] + 0.11 * imgData[ Index + 2 ]
|
|
347
347
|
for ( var k = 0; k < 3; k++ ) {
|
|
348
|
-
let current = imgData[ Index + k ]
|
|
349
|
-
imgData[ Index + k ] = current + ( terminal - current ) * grayScale
|
|
348
|
+
let current = imgData[ Index + k ]
|
|
349
|
+
imgData[ Index + k ] = current + ( terminal - current ) * grayScale
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
imgData[ Index ] *= rCorrect
|
|
354
|
-
imgData[ Index + 1 ] *= gCorrect
|
|
355
|
-
imgData[ Index + 2 ] *= bCorrect
|
|
353
|
+
imgData[ Index ] *= rCorrect
|
|
354
|
+
imgData[ Index + 1 ] *= gCorrect
|
|
355
|
+
imgData[ Index + 2 ] *= bCorrect
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
-
ctx.putImageData( newImage,0,0 )
|
|
360
|
+
ctx.putImageData( newImage,0,0 )
|
|
361
361
|
|
|
362
|
-
let newDataUrl = canvas.toDataURL( 'image/jpeg' )
|
|
362
|
+
let newDataUrl = canvas.toDataURL( 'image/jpeg' )
|
|
363
363
|
|
|
364
364
|
{
|
|
365
|
-
let Picture = await $.ImageLoader( newDataUrl )
|
|
365
|
+
let Picture = await $.ImageLoader( newDataUrl )
|
|
366
366
|
let {
|
|
367
367
|
width: pictW,
|
|
368
368
|
height: pictH
|
|
369
|
-
} = Picture
|
|
370
|
-
let pictAsp = pictW / pictH
|
|
369
|
+
} = Picture
|
|
370
|
+
let pictAsp = pictW / pictH
|
|
371
371
|
|
|
372
372
|
this.Picture = {
|
|
373
373
|
...this.Picture,
|
|
@@ -377,11 +377,11 @@ class CroppImage {
|
|
|
377
377
|
? this.pst.frame.w / pictW
|
|
378
378
|
: this.pst.frame.h / pictH
|
|
379
379
|
}
|
|
380
|
-
// this.pst.imageX = pictW / 2
|
|
381
|
-
// this.pst.imageY = pictH / 2
|
|
380
|
+
// this.pst.imageX = pictW / 2
|
|
381
|
+
// this.pst.imageY = pictH / 2
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
this.drawImage()
|
|
384
|
+
this.drawImage()
|
|
385
385
|
}
|
|
386
386
|
drawImage( _imageX?: number,_imageY?: number ) {
|
|
387
387
|
let {
|
|
@@ -392,40 +392,40 @@ class CroppImage {
|
|
|
392
392
|
pst: {
|
|
393
393
|
frame
|
|
394
394
|
}
|
|
395
|
-
} = this
|
|
395
|
+
} = this
|
|
396
396
|
|
|
397
|
-
let ImageX = _imageX || this.pst.imageX
|
|
398
|
-
let ImageY = _imageY || this.pst.imageY
|
|
397
|
+
let ImageX = _imageX || this.pst.imageX
|
|
398
|
+
let ImageY = _imageY || this.pst.imageY
|
|
399
399
|
|
|
400
400
|
{
|
|
401
|
-
let scale = this.scale.current / 100
|
|
401
|
+
let scale = this.scale.current / 100
|
|
402
402
|
|
|
403
|
-
let totalScale = this.Picture.revisedAspect * scale
|
|
403
|
+
let totalScale = this.Picture.revisedAspect * scale
|
|
404
404
|
|
|
405
|
-
let imgX = this.pst.centerX - ImageX * totalScale
|
|
406
|
-
let imgY = this.pst.centerY - ImageY * totalScale
|
|
407
|
-
let imgW = this.Picture.elm.width * totalScale
|
|
408
|
-
let imgH = this.Picture.elm.height * totalScale
|
|
405
|
+
let imgX = this.pst.centerX - ImageX * totalScale
|
|
406
|
+
let imgY = this.pst.centerY - ImageY * totalScale
|
|
407
|
+
let imgW = this.Picture.elm.width * totalScale
|
|
408
|
+
let imgH = this.Picture.elm.height * totalScale
|
|
409
409
|
|
|
410
410
|
{
|
|
411
|
-
let minX = this.pst.frame.x + this.pst.frame.w - imgW
|
|
412
|
-
let maxX = this.pst.frame.x
|
|
413
|
-
let minY = this.pst.frame.y + this.pst.frame.h - imgH
|
|
414
|
-
let maxY = this.pst.frame.y
|
|
411
|
+
let minX = this.pst.frame.x + this.pst.frame.w - imgW
|
|
412
|
+
let maxX = this.pst.frame.x
|
|
413
|
+
let minY = this.pst.frame.y + this.pst.frame.h - imgH
|
|
414
|
+
let maxY = this.pst.frame.y
|
|
415
415
|
|
|
416
|
-
let extraX = 0
|
|
417
|
-
if ( imgX < minX ) extraX = imgX - minX
|
|
418
|
-
if ( imgX > maxX ) extraX = imgX - maxX
|
|
416
|
+
let extraX = 0
|
|
417
|
+
if ( imgX < minX ) extraX = imgX - minX
|
|
418
|
+
if ( imgX > maxX ) extraX = imgX - maxX
|
|
419
419
|
|
|
420
|
-
let extraY = 0
|
|
421
|
-
if ( imgY < minY ) extraY = imgY - minY
|
|
422
|
-
if ( imgY > maxY ) extraY = imgY - maxY
|
|
420
|
+
let extraY = 0
|
|
421
|
+
if ( imgY < minY ) extraY = imgY - minY
|
|
422
|
+
if ( imgY > maxY ) extraY = imgY - maxY
|
|
423
423
|
|
|
424
|
-
this.dragEffectInfo.origin.x += extraX / 2 / this.dragEffectInfo.frameExpandRate.x
|
|
425
|
-
this.dragEffectInfo.origin.y += extraY / 2 / this.dragEffectInfo.frameExpandRate.y
|
|
424
|
+
this.dragEffectInfo.origin.x += extraX / 2 / this.dragEffectInfo.frameExpandRate.x
|
|
425
|
+
this.dragEffectInfo.origin.y += extraY / 2 / this.dragEffectInfo.frameExpandRate.y
|
|
426
426
|
|
|
427
|
-
imgX = Math.min( Math.max( imgX,minX ),maxX )
|
|
428
|
-
imgY = Math.min( Math.max( imgY,minY ),maxY )
|
|
427
|
+
imgX = Math.min( Math.max( imgX,minX ),maxX )
|
|
428
|
+
imgY = Math.min( Math.max( imgY,minY ),maxY )
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
this.pst.outImage = {
|
|
@@ -438,7 +438,7 @@ class CroppImage {
|
|
|
438
438
|
0,
|
|
439
439
|
this.Canvas.elm.width,
|
|
440
440
|
this.Canvas.elm.height
|
|
441
|
-
)
|
|
441
|
+
)
|
|
442
442
|
|
|
443
443
|
ctx.drawImage(
|
|
444
444
|
this.Picture.elm,
|
|
@@ -448,41 +448,41 @@ class CroppImage {
|
|
|
448
448
|
imgY,
|
|
449
449
|
imgW,
|
|
450
450
|
imgH
|
|
451
|
-
)
|
|
451
|
+
)
|
|
452
452
|
}
|
|
453
453
|
|
|
454
454
|
{
|
|
455
455
|
if ( use == 'profile' ) {
|
|
456
|
-
ctx.fillStyle = 'rgba( 20,24,20,.3 )'
|
|
457
|
-
ctx.beginPath()
|
|
458
|
-
ctx.arc( this.Canvas.elm.width / 2,this.Canvas.elm.height / 2,this.Canvas.elm.width,0,Math.PI * 2,true )
|
|
459
|
-
ctx.arc( this.Canvas.elm.width / 2,this.Canvas.elm.height / 2,this.Canvas.elm.width / 3 * 2 / 2,0,Math.PI * 2,false )
|
|
460
|
-
ctx.closePath()
|
|
461
|
-
ctx.fill()
|
|
456
|
+
ctx.fillStyle = 'rgba( 20,24,20,.3 )'
|
|
457
|
+
ctx.beginPath()
|
|
458
|
+
ctx.arc( this.Canvas.elm.width / 2,this.Canvas.elm.height / 2,this.Canvas.elm.width,0,Math.PI * 2,true )
|
|
459
|
+
ctx.arc( this.Canvas.elm.width / 2,this.Canvas.elm.height / 2,this.Canvas.elm.width / 3 * 2 / 2,0,Math.PI * 2,false )
|
|
460
|
+
ctx.closePath()
|
|
461
|
+
ctx.fill()
|
|
462
462
|
} else if ( use == 'header' ) {
|
|
463
|
-
ctx.fillStyle = 'rgba( 20,24,20,.3 )'
|
|
463
|
+
ctx.fillStyle = 'rgba( 20,24,20,.3 )'
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
-
ctx.beginPath()
|
|
467
|
-
ctx.moveTo( 0,0 )
|
|
468
|
-
ctx.lineTo( this.Canvas.elm.width,0 )
|
|
469
|
-
ctx.lineTo( this.Canvas.elm.width,this.Canvas.elm.height )
|
|
470
|
-
ctx.lineTo( 0,this.Canvas.elm.height )
|
|
471
|
-
ctx.lineTo( 0,0 )
|
|
472
|
-
ctx.closePath()
|
|
473
|
-
|
|
474
|
-
ctx.lineTo( frame.x,frame.y )
|
|
475
|
-
ctx.lineTo( frame.x,frame.y + frame.h )
|
|
476
|
-
ctx.lineTo( frame.x + frame.w,frame.y + frame.h )
|
|
477
|
-
ctx.lineTo( frame.x + frame.w,frame.y )
|
|
478
|
-
ctx.lineTo( frame.x,frame.y )
|
|
479
|
-
ctx.fill()
|
|
480
|
-
|
|
481
|
-
let body = $( document.body )
|
|
482
|
-
let themeColorHSL = body.getStyleProperty( '--color-theme-hsl' )
|
|
483
|
-
ctx.lineWidth = this.Canvas.elm.width / 200
|
|
484
|
-
ctx.strokeStyle = `hsla( ${ themeColorHSL },1 )
|
|
485
|
-
ctx.strokeRect( frame.x,frame.y,frame.w,frame.h )
|
|
466
|
+
ctx.beginPath()
|
|
467
|
+
ctx.moveTo( 0,0 )
|
|
468
|
+
ctx.lineTo( this.Canvas.elm.width,0 )
|
|
469
|
+
ctx.lineTo( this.Canvas.elm.width,this.Canvas.elm.height )
|
|
470
|
+
ctx.lineTo( 0,this.Canvas.elm.height )
|
|
471
|
+
ctx.lineTo( 0,0 )
|
|
472
|
+
ctx.closePath()
|
|
473
|
+
|
|
474
|
+
ctx.lineTo( frame.x,frame.y )
|
|
475
|
+
ctx.lineTo( frame.x,frame.y + frame.h )
|
|
476
|
+
ctx.lineTo( frame.x + frame.w,frame.y + frame.h )
|
|
477
|
+
ctx.lineTo( frame.x + frame.w,frame.y )
|
|
478
|
+
ctx.lineTo( frame.x,frame.y )
|
|
479
|
+
ctx.fill()
|
|
480
|
+
|
|
481
|
+
let body = $( document.body )
|
|
482
|
+
let themeColorHSL = body.getStyleProperty( '--color-theme-hsl' )
|
|
483
|
+
ctx.lineWidth = this.Canvas.elm.width / 200
|
|
484
|
+
ctx.strokeStyle = `hsla( ${ themeColorHSL },1 )`
|
|
485
|
+
ctx.strokeRect( frame.x,frame.y,frame.w,frame.h )
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
async export() {
|
|
@@ -493,48 +493,48 @@ class CroppImage {
|
|
|
493
493
|
outImage,
|
|
494
494
|
frame
|
|
495
495
|
}
|
|
496
|
-
} = this
|
|
496
|
+
} = this
|
|
497
497
|
|
|
498
|
-
let ratioX = outImage.w / Picture.elm.width
|
|
499
|
-
let ratioY = outImage.h / Picture.elm.height
|
|
498
|
+
let ratioX = outImage.w / Picture.elm.width
|
|
499
|
+
let ratioY = outImage.h / Picture.elm.height
|
|
500
500
|
|
|
501
|
-
let Left = ( frame.x - outImage.x ) / ratioX
|
|
502
|
-
let Right = ( frame.x - outImage.x + frame.w ) / ratioX
|
|
501
|
+
let Left = ( frame.x - outImage.x ) / ratioX
|
|
502
|
+
let Right = ( frame.x - outImage.x + frame.w ) / ratioX
|
|
503
503
|
|
|
504
|
-
let Top = ( frame.y - outImage.y ) / ratioY
|
|
505
|
-
let Bottom = ( frame.y - outImage.y + frame.h ) / ratioY
|
|
504
|
+
let Top = ( frame.y - outImage.y ) / ratioY
|
|
505
|
+
let Bottom = ( frame.y - outImage.y + frame.h ) / ratioY
|
|
506
506
|
|
|
507
|
-
let Files: any = Array.from( { length: develops.length } )
|
|
507
|
+
let Files: any = Array.from( { length: develops.length } )
|
|
508
508
|
|
|
509
|
-
let MimeType = 'image/jpeg'
|
|
509
|
+
let MimeType = 'image/jpeg'
|
|
510
510
|
|
|
511
511
|
for ( let index = 0; index < develops.length; index++ ) {
|
|
512
512
|
let {
|
|
513
513
|
size,maxSize
|
|
514
|
-
} = develops[ index ]
|
|
514
|
+
} = develops[ index ]
|
|
515
515
|
|
|
516
516
|
maxSize = maxSize || {
|
|
517
517
|
S: 1024 * 20,
|
|
518
518
|
R: 1024 * 100,
|
|
519
519
|
L: 1024 * 350
|
|
520
|
-
}[ size ]
|
|
520
|
+
}[ size ]
|
|
521
521
|
|
|
522
522
|
let width = {
|
|
523
523
|
S: 144,
|
|
524
524
|
R: 576,
|
|
525
525
|
L: 1152
|
|
526
|
-
}[ size ]
|
|
526
|
+
}[ size ]
|
|
527
527
|
|
|
528
|
-
let height = this.use == 'profile' ? width : width / 3
|
|
528
|
+
let height = this.use == 'profile' ? width : width / 3
|
|
529
529
|
|
|
530
|
-
let Preview = document.createElement( 'canvas' )
|
|
531
|
-
Preview.width = width
|
|
532
|
-
Preview.height = height
|
|
530
|
+
let Preview = document.createElement( 'canvas' )
|
|
531
|
+
Preview.width = width
|
|
532
|
+
Preview.height = height
|
|
533
533
|
|
|
534
|
-
let previewCtx = Preview.getContext( '2d' )
|
|
535
|
-
if ( !previewCtx ) return
|
|
534
|
+
let previewCtx = Preview.getContext( '2d' )
|
|
535
|
+
if ( !previewCtx ) return
|
|
536
536
|
|
|
537
|
-
previewCtx.clearRect( 0,0,width,height )
|
|
537
|
+
previewCtx.clearRect( 0,0,width,height )
|
|
538
538
|
previewCtx.drawImage(
|
|
539
539
|
this.Picture.elm,
|
|
540
540
|
Left,
|
|
@@ -544,25 +544,25 @@ class CroppImage {
|
|
|
544
544
|
0,0,
|
|
545
545
|
width,
|
|
546
546
|
height
|
|
547
|
-
)
|
|
547
|
+
)
|
|
548
548
|
|
|
549
|
-
let dataUrl = Preview.toDataURL( MimeType )
|
|
550
|
-
let blob = await dataUrl.toBlob( MimeType )
|
|
551
|
-
if ( !blob ) return
|
|
549
|
+
let dataUrl = Preview.toDataURL( MimeType )
|
|
550
|
+
let blob = await dataUrl.toBlob( MimeType )
|
|
551
|
+
if ( !blob ) return
|
|
552
552
|
|
|
553
553
|
if ( blob.size >= maxSize ) {
|
|
554
|
-
let Ratio = maxSize / blob.size
|
|
555
|
-
dataUrl = Preview.toDataURL( MimeType,Ratio * 0.92 )
|
|
556
|
-
blob = await dataUrl.toBlob( MimeType )
|
|
557
|
-
if ( !blob ) return
|
|
554
|
+
let Ratio = maxSize / blob.size
|
|
555
|
+
dataUrl = Preview.toDataURL( MimeType,Ratio * 0.92 )
|
|
556
|
+
blob = await dataUrl.toBlob( MimeType )
|
|
557
|
+
if ( !blob ) return
|
|
558
558
|
}
|
|
559
559
|
|
|
560
|
-
let file = new File( [ blob ],this.val_file.name,{ type: MimeType } )
|
|
560
|
+
let file = new File( [ blob ],this.val_file.name,{ type: MimeType } )
|
|
561
561
|
|
|
562
|
-
Files[ index ] = file
|
|
562
|
+
Files[ index ] = file
|
|
563
563
|
}
|
|
564
564
|
|
|
565
|
-
return Files
|
|
565
|
+
return Files
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
|
|
@@ -586,13 +586,13 @@ const Comps: {
|
|
|
586
586
|
options,
|
|
587
587
|
finishedCallback,
|
|
588
588
|
abortCallback,
|
|
589
|
-
} = params
|
|
589
|
+
} = params
|
|
590
590
|
let {
|
|
591
591
|
use,
|
|
592
592
|
develops = []
|
|
593
|
-
} = options
|
|
593
|
+
} = options
|
|
594
594
|
|
|
595
|
-
let [ val_componentID ] = React.useState( $.uuidGen( 32 ) )
|
|
595
|
+
let [ val_componentID ] = React.useState( $.uuidGen( 32 ) )
|
|
596
596
|
|
|
597
597
|
const DefaultOptions = {
|
|
598
598
|
scale: {
|
|
@@ -605,10 +605,10 @@ const Comps: {
|
|
|
605
605
|
tone: 0
|
|
606
606
|
}
|
|
607
607
|
|
|
608
|
-
let [ val_scale,set_scale ] = React.useState( DefaultOptions.scale.default )
|
|
608
|
+
let [ val_scale,set_scale ] = React.useState( DefaultOptions.scale.default )
|
|
609
609
|
let [ val_rotate,set_rotate ] = React.useState( DefaultOptions.rotate )
|
|
610
|
-
let [ val_grayScale,set_grayScale ] = React.useState( DefaultOptions.grayScale )
|
|
611
|
-
let [ val_tone,set_tone ] = React.useState( DefaultOptions.tone )
|
|
610
|
+
let [ val_grayScale,set_grayScale ] = React.useState( DefaultOptions.grayScale )
|
|
611
|
+
let [ val_tone,set_tone ] = React.useState( DefaultOptions.tone )
|
|
612
612
|
|
|
613
613
|
React.useEffect( () => {
|
|
614
614
|
useStore.set( {
|
|
@@ -617,14 +617,14 @@ const Comps: {
|
|
|
617
617
|
} );
|
|
618
618
|
|
|
619
619
|
( async () => {
|
|
620
|
-
amotify.fn.Loader.fn.corner.active()
|
|
620
|
+
amotify.fn.Loader.fn.corner.active()
|
|
621
621
|
|
|
622
|
-
let { target } = await val_file.read()
|
|
623
|
-
if ( !target ) return
|
|
624
|
-
let dataUrl = target!.result as string
|
|
622
|
+
let { target } = await val_file.read()
|
|
623
|
+
if ( !target ) return
|
|
624
|
+
let dataUrl = target!.result as string
|
|
625
625
|
|
|
626
|
-
let Canvas = $( '#Canvas-' + val_componentID )[ 0 ] as HTMLCanvasElement
|
|
627
|
-
if ( !Canvas ) return
|
|
626
|
+
let Canvas = $( '#Canvas-' + val_componentID )[ 0 ] as HTMLCanvasElement
|
|
627
|
+
if ( !Canvas ) return
|
|
628
628
|
|
|
629
629
|
let __Cropper = new CroppImage( {
|
|
630
630
|
set_scale,
|
|
@@ -640,32 +640,32 @@ const Comps: {
|
|
|
640
640
|
tone: DefaultOptions.tone,
|
|
641
641
|
rotate: DefaultOptions.rotate
|
|
642
642
|
}
|
|
643
|
-
} )
|
|
643
|
+
} )
|
|
644
644
|
useStore.set( {
|
|
645
645
|
key: val_componentID,
|
|
646
646
|
value: {
|
|
647
647
|
Instance: __Cropper
|
|
648
648
|
}
|
|
649
|
-
} )
|
|
649
|
+
} )
|
|
650
650
|
|
|
651
651
|
const UserEffectStart = function ( event: any ) {
|
|
652
|
-
event.preventDefault()
|
|
652
|
+
event.preventDefault()
|
|
653
653
|
|
|
654
654
|
if ( event.touches && event.touches.length > 1 ) {
|
|
655
655
|
__Cropper.pinchEffect( {
|
|
656
656
|
eventType: 'start',
|
|
657
657
|
event
|
|
658
|
-
} )
|
|
658
|
+
} )
|
|
659
659
|
|
|
660
660
|
$( document )
|
|
661
661
|
.addEvent( {
|
|
662
662
|
eventType: 'touchmove',eventID: 'CropperEffectMove',option: { passive: false },
|
|
663
663
|
callback: ( event ) => {
|
|
664
|
-
event.preventDefault()
|
|
664
|
+
event.preventDefault()
|
|
665
665
|
__Cropper.pinchEffect( {
|
|
666
666
|
eventType: 'move',
|
|
667
667
|
event
|
|
668
|
-
} )
|
|
668
|
+
} )
|
|
669
669
|
},
|
|
670
670
|
} )
|
|
671
671
|
.addEvent( {
|
|
@@ -676,35 +676,35 @@ const Comps: {
|
|
|
676
676
|
__Cropper.dragEffect( {
|
|
677
677
|
eventType: 'start',
|
|
678
678
|
...$.getCursor( event )
|
|
679
|
-
} )
|
|
679
|
+
} )
|
|
680
680
|
|
|
681
|
-
let { type } = event
|
|
681
|
+
let { type } = event
|
|
682
682
|
|
|
683
683
|
$( document )
|
|
684
684
|
.addEvent( {
|
|
685
685
|
eventType: type == 'touchstart' ? 'touchmove' : 'mousemove',eventID: 'CropperEffectMove',option: { passive: false },
|
|
686
686
|
callback: ( event ) => {
|
|
687
|
-
DragEffect( 'move',event )
|
|
687
|
+
DragEffect( 'move',event )
|
|
688
688
|
},
|
|
689
689
|
} )
|
|
690
690
|
.addEvent( {
|
|
691
691
|
eventType: type == 'touchstart' ? 'touchend' : 'mouseup',eventID: 'CropperEffectEnd',option: { passive: false },
|
|
692
692
|
callback: ( event ) => {
|
|
693
|
-
DragEffect( 'end',event )
|
|
694
|
-
EventEnd( event )
|
|
693
|
+
DragEffect( 'end',event )
|
|
694
|
+
EventEnd( event )
|
|
695
695
|
},
|
|
696
|
-
} )
|
|
696
|
+
} )
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
699
|
const DragEffect = function ( eventType: 'move' | 'end',event: any ) {
|
|
700
|
-
event.preventDefault()
|
|
700
|
+
event.preventDefault()
|
|
701
701
|
__Cropper.dragEffect( {
|
|
702
702
|
eventType: eventType,
|
|
703
703
|
...$.getCursor( event )
|
|
704
|
-
} )
|
|
704
|
+
} )
|
|
705
705
|
}
|
|
706
706
|
const EventEnd = function ( event: any ) {
|
|
707
|
-
event.preventDefault()
|
|
707
|
+
event.preventDefault()
|
|
708
708
|
|
|
709
709
|
$( document ).removeEvent( [
|
|
710
710
|
'CropperEffectMove',
|
|
@@ -722,15 +722,15 @@ const Comps: {
|
|
|
722
722
|
eventID: 'CropperMouseWheel',
|
|
723
723
|
eventType: 'wheel',
|
|
724
724
|
callback: ( event ) => {
|
|
725
|
-
event.preventDefault()
|
|
725
|
+
event.preventDefault()
|
|
726
726
|
|
|
727
|
-
let bitScale = Number( event.wheelDelta * 0.04 )
|
|
728
|
-
let nextScale = __Cropper.scale.current + bitScale
|
|
727
|
+
let bitScale = Number( event.wheelDelta * 0.04 )
|
|
728
|
+
let nextScale = __Cropper.scale.current + bitScale
|
|
729
729
|
|
|
730
|
-
nextScale = Math.max( nextScale,__Cropper.scale.min )
|
|
731
|
-
nextScale = Math.min( nextScale,__Cropper.scale.max )
|
|
730
|
+
nextScale = Math.max( nextScale,__Cropper.scale.min )
|
|
731
|
+
nextScale = Math.min( nextScale,__Cropper.scale.max )
|
|
732
732
|
|
|
733
|
-
set_scale( nextScale )
|
|
733
|
+
set_scale( nextScale )
|
|
734
734
|
},
|
|
735
735
|
option: { passive: false }
|
|
736
736
|
} )
|
|
@@ -741,29 +741,29 @@ const Comps: {
|
|
|
741
741
|
.addEvent( {
|
|
742
742
|
eventType: 'mousedown',eventID: 'CropperMouseDown',
|
|
743
743
|
callback: UserEffectStart,option: { passive: false }
|
|
744
|
-
} )
|
|
744
|
+
} )
|
|
745
745
|
|
|
746
746
|
setTimeout( () => {
|
|
747
|
-
amotify.fn.Loader.fn.corner.stop()
|
|
748
|
-
},1000 )
|
|
749
|
-
} )()
|
|
750
|
-
},[ val_file.id ] )
|
|
747
|
+
amotify.fn.Loader.fn.corner.stop()
|
|
748
|
+
},1000 )
|
|
749
|
+
} )()
|
|
750
|
+
},[ val_file.id ] )
|
|
751
751
|
React.useEffect( () => {
|
|
752
|
-
let Instance: CroppImage = useStore.get( val_componentID )?.Instance
|
|
752
|
+
let Instance: CroppImage = useStore.get( val_componentID )?.Instance
|
|
753
753
|
if ( Instance ) {
|
|
754
|
-
Instance.updateScale( val_scale )
|
|
754
|
+
Instance.updateScale( val_scale )
|
|
755
755
|
}
|
|
756
|
-
},[ val_scale ] )
|
|
756
|
+
},[ val_scale ] )
|
|
757
757
|
React.useEffect( () => {
|
|
758
|
-
let Instance: CroppImage = useStore.get( val_componentID )?.Instance
|
|
758
|
+
let Instance: CroppImage = useStore.get( val_componentID )?.Instance
|
|
759
759
|
if ( Instance ) {
|
|
760
760
|
Instance.updateFilter( {
|
|
761
761
|
grayScale: val_grayScale,
|
|
762
762
|
tone: val_tone,
|
|
763
763
|
rotate: val_rotate
|
|
764
|
-
} )
|
|
764
|
+
} )
|
|
765
765
|
}
|
|
766
|
-
},[ val_grayScale,val_tone,val_rotate ] )
|
|
766
|
+
},[ val_grayScale,val_tone,val_rotate ] )
|
|
767
767
|
|
|
768
768
|
return <Sheet.Comps.Body>
|
|
769
769
|
<Flex
|
|
@@ -852,7 +852,7 @@ const Comps: {
|
|
|
852
852
|
<Buttons.Button.Border.R
|
|
853
853
|
flexGrid={ 1 }
|
|
854
854
|
onClick={ () => {
|
|
855
|
-
abortCallback()
|
|
855
|
+
abortCallback()
|
|
856
856
|
} }
|
|
857
857
|
>
|
|
858
858
|
キャンセル
|
|
@@ -860,15 +860,15 @@ const Comps: {
|
|
|
860
860
|
<Buttons.Button.Prime.R
|
|
861
861
|
flexGrid={ 2 }
|
|
862
862
|
onClick={ async () => {
|
|
863
|
-
let Instance: CroppImage = useStore.get( val_componentID )?.Instance
|
|
864
|
-
if ( !Instance ) return
|
|
865
|
-
amotify.fn.Loader.fn.mini.active( 'CropperExportation' )
|
|
866
|
-
let Files = await Instance.export()
|
|
863
|
+
let Instance: CroppImage = useStore.get( val_componentID )?.Instance
|
|
864
|
+
if ( !Instance ) return
|
|
865
|
+
amotify.fn.Loader.fn.mini.active( 'CropperExportation' )
|
|
866
|
+
let Files = await Instance.export()
|
|
867
867
|
|
|
868
868
|
setTimeout( () => {
|
|
869
|
-
amotify.fn.Loader.fn.mini.stop( 'CropperExportation' )
|
|
870
|
-
finishedCallback( Files )
|
|
871
|
-
},3000 )
|
|
869
|
+
amotify.fn.Loader.fn.mini.stop( 'CropperExportation' )
|
|
870
|
+
finishedCallback( Files )
|
|
871
|
+
},3000 )
|
|
872
872
|
} }
|
|
873
873
|
>
|
|
874
874
|
<Row.Center
|
|
@@ -883,10 +883,10 @@ const Comps: {
|
|
|
883
883
|
</Flex>
|
|
884
884
|
</Column>
|
|
885
885
|
</Flex>
|
|
886
|
-
</Sheet.Comps.Body
|
|
886
|
+
</Sheet.Comps.Body>
|
|
887
887
|
},
|
|
888
888
|
SettingRegion: ( params ) => {
|
|
889
|
-
let ToneList: amotify.fn.Input.List.OptionParams[] = []
|
|
889
|
+
let ToneList: amotify.fn.Input.List.OptionParams[] = []
|
|
890
890
|
for ( let index = 1; index <= 10; index++ ) {
|
|
891
891
|
ToneList.push( {
|
|
892
892
|
value: index,
|
|
@@ -904,7 +904,7 @@ const Comps: {
|
|
|
904
904
|
{ [ '','暖色','寒色','セピア','シアン','マゼンタ','イエロー','オリジナル1','オリジナル2','オリジナル3','オリジナル4' ][ index ] }
|
|
905
905
|
</Box>
|
|
906
906
|
</>
|
|
907
|
-
} )
|
|
907
|
+
} )
|
|
908
908
|
}
|
|
909
909
|
|
|
910
910
|
return <>
|
|
@@ -921,16 +921,16 @@ const Comps: {
|
|
|
921
921
|
>
|
|
922
922
|
<Buttons.Button.Border.R
|
|
923
923
|
onClick={ () => {
|
|
924
|
-
let next = params.val_rotate - 90
|
|
925
|
-
if ( next < 0 ) next += 360
|
|
926
|
-
params.set_rotate( next )
|
|
924
|
+
let next = params.val_rotate - 90
|
|
925
|
+
if ( next < 0 ) next += 360
|
|
926
|
+
params.set_rotate( next )
|
|
927
927
|
} }
|
|
928
928
|
>
|
|
929
929
|
<FAI icon={ faRotateLeft } /> 左に回転
|
|
930
930
|
</Buttons.Button.Border.R>
|
|
931
931
|
<Buttons.Button.Border.R
|
|
932
932
|
onClick={ () => {
|
|
933
|
-
params.set_rotate( ( params.val_rotate + 90 ) % 360 )
|
|
933
|
+
params.set_rotate( ( params.val_rotate + 90 ) % 360 )
|
|
934
934
|
} }
|
|
935
935
|
>
|
|
936
936
|
右に回転 <FAI icon={ faRotateRight } />
|
|
@@ -952,13 +952,13 @@ const Comps: {
|
|
|
952
952
|
max={ params.DefaultOptions.scale.max - 100 }
|
|
953
953
|
step={ 25 }
|
|
954
954
|
onUpdateValidValue={ ( { eventType,value } ) => {
|
|
955
|
-
params.set_scale( value + 100 )
|
|
955
|
+
params.set_scale( value + 100 )
|
|
956
956
|
} }
|
|
957
957
|
legends={ {
|
|
958
958
|
enable: true,
|
|
959
959
|
custom: ( value ) => {
|
|
960
|
-
let scale = Math.round( 100 + value )
|
|
961
|
-
return 'x' + scale / 100
|
|
960
|
+
let scale = Math.round( 100 + value )
|
|
961
|
+
return 'x' + scale / 100
|
|
962
962
|
}
|
|
963
963
|
} }
|
|
964
964
|
/>
|
|
@@ -979,7 +979,7 @@ const Comps: {
|
|
|
979
979
|
max={ 100 }
|
|
980
980
|
step={ 25 }
|
|
981
981
|
onUpdateValidValue={ ( { value } ) => {
|
|
982
|
-
params.set_grayScale( value )
|
|
982
|
+
params.set_grayScale( value )
|
|
983
983
|
} }
|
|
984
984
|
legends={ {
|
|
985
985
|
enable: true,
|
|
@@ -1019,12 +1019,12 @@ const Comps: {
|
|
|
1019
1019
|
...ToneList
|
|
1020
1020
|
] }
|
|
1021
1021
|
onUpdateValidValue={ ( { value } ) => {
|
|
1022
|
-
params.set_tone( value[ 0 ] )
|
|
1022
|
+
params.set_tone( value[ 0 ] )
|
|
1023
1023
|
} }
|
|
1024
1024
|
/>
|
|
1025
1025
|
</Box>
|
|
1026
1026
|
</Column>
|
|
1027
|
-
|
|
1027
|
+
</>
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
1030
|
|
|
@@ -1034,9 +1034,9 @@ export const Cropper: amotify.fn.Cropper.Methods = {
|
|
|
1034
1034
|
// accept: 'image/jpeg,image/jpg,image/png,image/gif',
|
|
1035
1035
|
accept: 'image',
|
|
1036
1036
|
multiple: false
|
|
1037
|
-
} )
|
|
1037
|
+
} )
|
|
1038
1038
|
|
|
1039
|
-
let sheetID = 'CropperImage'
|
|
1039
|
+
let sheetID = 'CropperImage'
|
|
1040
1040
|
amotify.fn.Sheet.open( {
|
|
1041
1041
|
sheetID: sheetID,
|
|
1042
1042
|
type: 'normal.middleCenter',
|
|
@@ -1048,16 +1048,16 @@ export const Cropper: amotify.fn.Cropper.Methods = {
|
|
|
1048
1048
|
val_file={ Image[ 0 ] as any }
|
|
1049
1049
|
options={ params }
|
|
1050
1050
|
finishedCallback={ ( files ) => {
|
|
1051
|
-
amotify.fn.Sheet.close( sheetID )
|
|
1052
|
-
params.onProcessFinished( files )
|
|
1051
|
+
amotify.fn.Sheet.close( sheetID )
|
|
1052
|
+
params.onProcessFinished( files )
|
|
1053
1053
|
} }
|
|
1054
1054
|
abortCallback={ () => {
|
|
1055
|
-
amotify.fn.Sheet.close( sheetID )
|
|
1055
|
+
amotify.fn.Sheet.close( sheetID )
|
|
1056
1056
|
} }
|
|
1057
1057
|
/>,
|
|
1058
1058
|
close_option: {
|
|
1059
1059
|
escapeKeyDown: false
|
|
1060
1060
|
}
|
|
1061
|
-
} )
|
|
1061
|
+
} )
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|