Skip to content

Commit 7ed7aa8

Browse files
committed
fix rotate captcha
1 parent 65dc617 commit 7ed7aa8

16 files changed

+49
-16
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div align="center">
22
<img width="120" style="padding-top: 50px; margin: 0;" src="http://47.104.180.148/go-captcha/gocaptcha_logo.svg?v=1"/>
33
<h1 style="margin: 0; padding: 0">Go Captcha</h1>
4-
<p>Behavior Captcha For Angular</p>
4+
<p>The Behavior Captcha For The Angular</p>
55

66
</div>
77

@@ -292,6 +292,7 @@ interface RotateData {
292292
angle: number;
293293
image: string;
294294
thumb: string;
295+
thumbSize: number;
295296
}
296297

297298
// events = {}

README_zh.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ interface RotateData {
293293
angle: number;
294294
image: string;
295295
thumb: string;
296+
thumbSize: number;
296297
}
297298

298299
// events = {}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "go-captcha-angular",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "GoCaptcha for Angular, which implements click mode, slider mode, drag-drop mode and rotation mode.",
55
"private": false,
66
"email": "[email protected]",

projects/example/src/app/app.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ export class AppComponent {
207207

208208
////////////////////////////////
209209
rotateData = {
210-
angle: 20,
211210
image: this.rotateImage,
212211
thumb: this.rotateThumb,
212+
thumbSize: 195
213213
}
214214

215215
rotateEvents = {
@@ -221,7 +221,6 @@ export class AppComponent {
221221
...this.rotateData,
222222
image: this.clickImage2,
223223
thumb: this.rotateThumb,
224-
angle: 40,
225224
}
226225
console.log("refresh >>>>>>>")
227226
},

projects/go-captcha-angular/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div align="center">
22
<img width="120" style="padding-top: 50px; margin: 0;" src="http://47.104.180.148/go-captcha/gocaptcha_logo.svg?v=1"/>
33
<h1 style="margin: 0; padding: 0">Go Captcha</h1>
4-
<p>Behavior Captcha For Angular</p>
4+
<p>The Behavior Captcha For The Angular</p>
55

66
</div>
77

@@ -292,6 +292,7 @@ interface RotateData {
292292
angle: number;
293293
image: string;
294294
thumb: string;
295+
thumbSize: number;
295296
}
296297

297298
// events = {}

projects/go-captcha-angular/README_zh.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ interface RotateData {
293293
angle: number;
294294
image: string;
295295
thumb: string;
296+
thumbSize: number;
296297
}
297298

298299
// events = {}

projects/go-captcha-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "go-captcha-angular",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"license": "MIT",
55
"description": "GoCaptcha for Angular, which implements click mode, slider mode, drag-drop mode and rotation mode.",
66
"keywords": [

projects/go-captcha-angular/src/lib/modules/click/click.component.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
z-index: 2;
1515
width: 22px;
1616
height: 22px;
17-
color: #cedffe;
18-
background: #3e7cff;
17+
color: var(--go-captcha-theme-dot-color);
18+
background: var(--go-captcha-theme-dot-bg-color);
1919
border: 3px solid #f7f9fb;
20+
border-color: var(--go-captcha-theme-dot-border-color);
2021
display:-webkit-box;
2122
display:-webkit-flex;
2223
display:-ms-flexbox;

projects/go-captcha-angular/src/lib/modules/click/click.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class ClickComponent {
3838
}
3939

4040
get hasDisplayImageState() {
41-
return this.localData.image != '' || this.localData.thumb != ''
41+
return (this.localData.image && this.localData.image.length > 0) || (this.localData.thumb && this.localData.thumb.length > 0)
4242
}
4343

4444
clickEvent(e: Event|any){

projects/go-captcha-angular/src/lib/modules/rotate/rotate-instance.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@ export const defaultRotateConfig = ():RotateConfig => ({
3030
})
3131

3232
export interface RotateData {
33-
angle: number;
33+
angle?: number;
3434
image: string;
3535
thumb: string;
36+
thumbSize?: number;
3637
}
3738

3839
export const defaultRotateData = (): RotateData =>({
3940
angle: 0,
4041
image: '',
41-
thumb: ''
42+
thumb: '',
43+
thumbSize: 0
4244
})
4345

4446

projects/go-captcha-angular/src/lib/modules/rotate/rotate.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<div class="gc-thumb gc-rotate-thumb">
5151
<div
5252
class="gc-rotate-thumb-block"
53-
[style]="{ transform: 'rotate('+thumbAngle+'deg)'}"
53+
[style]="thumbSizeStyle"
5454
>
5555
<img
5656
[class]="{'gc-hide': localData.thumb == ''}"

projects/go-captcha-angular/src/lib/modules/rotate/rotate.component.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@
5656
right: 0;
5757
bottom: 0;
5858

59+
display: -webkit-box;
60+
display: -moz-box;
61+
display: -ms-flexbox;
62+
display: -webkit-flex;
63+
display: flex;
64+
justify-content: center;
65+
align-items: center;
66+
5967
img {
6068
max-width: 100%;
6169
max-height: 100%;

projects/go-captcha-angular/src/lib/modules/rotate/rotate.component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,22 @@ export class RotateComponent {
4545
this.localEvents = events
4646
}
4747

48+
get thumbSizeStyle() {
49+
return {
50+
transform: 'rotate('+this.thumbAngle+'deg)',
51+
...(this.localData.thumbSize > 0 ? {
52+
width: this.localData.thumbSize + 'px',
53+
height: this.localData.thumbSize + 'px'
54+
} : {})
55+
}
56+
}
57+
4858
get hasDisplayWrapperState() {
4959
return (this.localConfig.width || 0) > 0 || (this.localConfig.height || 0) > 0
5060
}
5161

5262
get hasDisplayImageState() {
53-
return this.localData.image != '' || this.localData.thumb != ''
63+
return (this.localData.image && this.localData.image.length > 0) || (this.localData.thumb && this.localData.thumb.length > 0)
5464
}
5565

5666
get size() {

projects/go-captcha-angular/src/lib/modules/slide-region/slide-region.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class SlideRegionComponent {
6262
}
6363

6464
get hasDisplayImageState() {
65-
return this.localData.image != '' || this.localData.thumb != ''
65+
return (this.localData.image && this.localData.image.length > 0) || (this.localData.thumb && this.localData.thumb.length > 0)
6666
}
6767

6868
private dsFn = (event: any) => event.preventDefault()

projects/go-captcha-angular/src/lib/modules/slide/slide.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class SlideComponent {
5555
}
5656

5757
get hasDisplayImageState() {
58-
return this.localData.image != '' || this.localData.thumb != ''
58+
return (this.localData.image && this.localData.image.length > 0) || (this.localData.thumb && this.localData.thumb.length > 0)
5959
}
6060

6161
private dsFn = (event: any) => event.preventDefault()

projects/go-captcha-angular/src/scss/go-captcha.scss

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
--go-captcha-theme-loading-icon-color: #3e7cff;
2222
--go-captcha-theme-body-bg-color: #34383e;
2323

24+
--go-captcha-theme-dot-color: #cedffe;
25+
--go-captcha-theme-dot-bg-color: #3e7cff;
26+
--go-captcha-theme-dot-border-color: #f7f9fb;
27+
2428
--go-captcha-theme-default-color: #3e7cff;
2529
--go-captcha-theme-default-bg-color: #ecf5ff;
2630
--go-captcha-theme-default-border-color: #3e7cff;
@@ -42,7 +46,7 @@
4246
.go-captcha {
4347
&.gc-wrapper {
4448
padding: 12px 16px;
45-
background-color: var(--go-captcha-theme-bg-color);
49+
//background-color: var(--go-captcha-theme-bg-color);
4650
-webkit-touch-callout: none;
4751
-webkit-user-select: none;
4852
-moz-user-select: none;
@@ -62,6 +66,10 @@
6266
box-shadow: 0 0 20px rgba(100, 100, 100, 0.1);
6367
-webkit-box-shadow: 0 0 20px rgba(100, 100, 100, 0.1);
6468
-moz-box-shadow: 0 0 20px rgba(100, 100, 100, 0.1);
69+
70+
&.gc-wrapper {
71+
background-color: var(--go-captcha-theme-bg-color);
72+
}
6573
}
6674

6775
.gc-header {
@@ -114,6 +122,7 @@
114122
overflow: hidden;
115123

116124
.gc-body-inner{
125+
position: relative;
117126
background: var(--go-captcha-theme-body-bg-color);
118127
}
119128
}

0 commit comments

Comments
 (0)