appscms-tools-theme 2.2.5 → 2.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 453710446bc4e201a7b5e2df1de53122a01e9fa2aaa19050a271ec2169759646
4
- data.tar.gz: dba6831293fca990e81216e8c653ff34e288b780dc280c8cf863803666134357
3
+ metadata.gz: 57fe8e11e3e005629d832b648a76d1f6cec1aa1b7986a130927bca4759db705d
4
+ data.tar.gz: c96a0e45465037b82000a455acd3b5b8f767da64575769b6d2044348c3b9d179
5
5
  SHA512:
6
- metadata.gz: '01628b3a082ffaf783bb7038fa49f973510388143d427ff730656a637cd3ae9c264c884eb260ab61ac17cdd91c40281311e1228327b20b292b7e38069feed044'
7
- data.tar.gz: da1d00b2138166f94355700089c046889a6d25da6ad67f8b7b2d2425d808f1618fa25952747831692ddd49d47ec70793ef2c596663e7e0f496a6b35960496aea
6
+ metadata.gz: b78f545a979e8f4f0776e197b025dcefe89ad64497c3bac8bb2c1847af557121cc8e3de450a85876f654bfd02eaca0a13d30833f693a43ae17f1bcb89c6cb3bb
7
+ data.tar.gz: 946616197aa6a3131e2dac36eda434e22fb410f7c131ffa12e49f03e4ed31c68704423ab2b306ac4ce5015b13d6f6e2e58d8a98e47672cb968f9b07a49edcab6
@@ -46,20 +46,6 @@
46
46
  {
47
47
  "type": "image",
48
48
  "label": "1."
49
- },
50
- {
51
- "label": "label",
52
- "type": "text",
53
- "id": "text-1"
54
- },
55
- {
56
- "type": "image",
57
- "label": "1."
58
- },
59
- {
60
- "label": "label",
61
- "type": "text",
62
- "id": "text-2"
63
49
  }
64
50
  ]
65
51
  }
data/assets/js/frame.js CHANGED
@@ -52,16 +52,21 @@ form.addEventListener('submit', (e) => {
52
52
  e.preventDefault()
53
53
  drawImage()
54
54
  })
55
- const drawInputImage = (ctx, item, indexValue, canvas, image) => {
55
+ const drawInputImage = (ctx, item, indexValue) => {
56
56
  return new Promise((resolve, reject) => {
57
57
  let image = document.createElement('img')
58
58
  image.src = files[indexValue]
59
59
  image.onload = () => {
60
+ ctx.save()
60
61
  image.width = Number(item.width)
61
62
  image.height = Number(item.height)
62
63
  if (item.filter) {
63
64
  ctx.filter = item.filter
64
65
  }
66
+ if (item.rotate) {
67
+ ctx.rotate((item.rotate * Math.PI) / 180)
68
+ }
69
+
65
70
  ctx.drawImage(
66
71
  image,
67
72
  Number(item.x),
@@ -69,31 +74,35 @@ const drawInputImage = (ctx, item, indexValue, canvas, image) => {
69
74
  image.width,
70
75
  image.height
71
76
  )
72
- if (item.rotate) {
73
- drawRotated(item.rotate, ctx, canvas, image, item)
77
+ if (item.translate) {
78
+ ctx.translate(item.translate.x, item.translate.y)
79
+ }
80
+ if (item.skew) {
81
+ ctx.setTransform(1, item.skew.x, item.skew.y, 1, 0, 0)
74
82
  }
83
+ ctx.restore()
75
84
  resolve()
76
85
  }
77
86
  })
78
87
  }
79
88
 
80
89
  const drawRotated = (degrees, ctx, canvas, image, item) => {
81
- console.log(image)
82
- ctx.clearRect(0, 0, canvas.width, canvas.height)
90
+ // console.log(image)
91
+ // ctx.clearRect(0, 0, canvas.width, canvas.height)
83
92
 
84
93
  // save the unrotatedctx of the canvas so we can restore it later
85
94
  // the alternative is to untranslate & unrotate after drawing
86
95
  ctx.save()
87
96
 
88
97
  // move to the center of the canvas
89
- ctx.translate(item.x, item.y)
98
+ // ctx.translate(item.x, item.y)
90
99
 
91
100
  // rotate the canvas to the specified degrees
92
- ctx.rotate((degrees * Math.PI) / 180)
101
+ ctx.rotate((50 * Math.PI) / 180)
93
102
 
94
103
  // draw the image
95
104
  // since thectx is rotated, the image will be rotated also
96
- ctx.drawImage(image, -image.width / 2, -image.width / 2)
105
+ // ctx.drawImage(image, -image.width / 2, -image.width / 2)
97
106
 
98
107
  // we’re done with the rotating so restore the unrotatedctx
99
108
  ctx.restore()
@@ -118,7 +127,7 @@ const drawImage = () => {
118
127
  })
119
128
  ).then(() => {
120
129
  ctx.filter = 'none'
121
- ctx.drawImage(img, 0, 0, canvas.width, canvas.height)
130
+ // ctx.drawImage(img, 0, 0, canvas.width, canvas.height)
122
131
  featureData.elements.map((item, indexValue) => {
123
132
  if (item.type === 'text') {
124
133
  let myFont = new FontFace(item.font, `url(${item.fontPath})`)
@@ -9,46 +9,13 @@
9
9
  "perspective": "",
10
10
  "height": 300,
11
11
  "width": 300,
12
- "x": 200,
13
- "y": 200,
12
+ "translate": {
13
+ "x": -5,
14
+ "y": -10
15
+ },
16
+ "x": 100,
17
+ "y": 100,
14
18
  "id": "file-1"
15
- },
16
- {
17
- "label": "",
18
- "id": "text-1",
19
- "type": "text",
20
- "x": "100",
21
- "y": "100",
22
- "color": "red",
23
- "rotate": 10,
24
- "fontFamily": "Calligraphy",
25
- "fontPath": "/assets/fonts/Calligraphy.ttf",
26
- "fontWeight": "bold",
27
- "fontSize": 50
28
- },
29
- {
30
- "type": "image",
31
- "imagePath": "",
32
- "filter": "grayscale(100%)",
33
- "perspective": "",
34
- "height": 300,
35
- "width": 300,
36
- "rotate": 1,
37
- "x": 0,
38
- "y": 0,
39
- "id": "file-3"
40
- },
41
- {
42
- "label": "",
43
- "id": "text-2",
44
- "type": "text",
45
- "x": "200",
46
- "y": "200",
47
- "color": "red",
48
- "fontFamily": "Calligraphy",
49
- "fontPath": "/assets/fonts/Calligraphy.ttf",
50
- "fontWeight": "bold",
51
- "fontSize": 50
52
19
  }
53
20
  ]
54
21
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appscms-tools-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - vivek-appscms
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-23 00:00:00.000000000 Z
11
+ date: 2022-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll