pixuireactcomponents 1.2.1 → 1.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -133,6 +133,10 @@ export class Slapface extends Component<any, any>
133
133
  constructor(props) {
134
134
  super(props)
135
135
  this.LoadGroup = this.props.LoadGroup;
136
+ for(let i = 0;i<this.LoadGroup.length;i++)
137
+ {
138
+ this.LoadGroup[i].isLoadDone = false;
139
+ }
136
140
  this.jumpButton = this.props.jumpButton? this.props.jumpButton : jumpButton
137
141
  this.settingsitems = this.props.settingsitems? this.props.settingsitems : settingsitems
138
142
  this.btn_closeButton = this.props.btn_closeButton? this.props.btn_closeButton : ''
@@ -150,9 +154,7 @@ export class Slapface extends Component<any, any>
150
154
  }
151
155
 
152
156
  return (
153
- <div className={SlapfaceLess.maininterface} style ={{display:this.actDisplay}}>
154
- <div style={{ flexDirection: 'row', flexWrap: 'nowrap' }}>
155
- </div>
157
+ <div style ={{display:this.actDisplay,width:"100%",height:"100%"}}>
156
158
  <div style={{ width: '100%', height: '100%', backgroundColor: "rgba(0,0,0,0.5)" }}>
157
159
  {<Group {...slapfaceinfo} closeAct = {this.closeAct}/>}
158
160
  </div>
@@ -198,9 +200,10 @@ class Group extends Component<any, any>
198
200
  // setTimeout(()=>{this.picBack.style.display = 'flex';
199
201
  // this.closeClick()},300)
200
202
  // }
203
+ this.loadDisplay = "hidden"
201
204
  if(this.firstFrameDisplay == "none"){
202
205
  setTimeout(()=>{this.firstFrameDisplay = 'flex';
203
- this.closeClick()},0)
206
+ this.closeClick()},300)
204
207
  }
205
208
  }
206
209
 
@@ -217,10 +220,9 @@ class Group extends Component<any, any>
217
220
  closeClick(e?: Event) {
218
221
  e?.stopPropagation()
219
222
  let nextIndex = this.groupIndexList.CheckReady();
220
-
221
223
  // setTimeout(() => {
222
224
  // this.loadDisplay = "visible"
223
- // }, 1);
225
+ // }, 50);
224
226
  this.loadDisplay = "visible"
225
227
  this.elseDisplay = "hidden"
226
228
  if (nextIndex != -1) {
@@ -243,16 +245,14 @@ class Group extends Component<any, any>
243
245
  )
244
246
  }
245
247
 
246
- return (<div ref={(div)=>{this.picBack = div}} style={{ width: '100%', height: '100%', alignItems: 'center', justifyContent: 'center', position: 'absolute'}} onAnimationEnd={() => {setTimeout(()=>{this.picBack.className = SlapfaceLess.groupBackReverse},10)}}>
248
+ return (<div style={{ width: '100%', height: '100%', alignItems: 'center', justifyContent: 'center', position: 'absolute'}}>
247
249
  <div onClick={() => { if (this.props.settingsitems.is_mask == false) return; this.closeClick() }} style={{ position: "absolute", width: "100%", height: "100%" }}></div>
248
- <div >
249
- <img src = {this.groupArr[this.state.curIndex].picture} style ={{visibility:this.elseDisplay,width: this.groupArr[this.state.curIndex].width, height: this.groupArr[this.state.curIndex].height}} onLoad = {()=>{let curIndex = this.state.curIndex;if(!this.groupArr[curIndex].isLoadDone) {this.groupArr[curIndex].isLoadDone = true; this.loadDisplay = "hidden";this.elseDisplay = "visible";this.forceUpdate()}}}></img>
250
- <div ref={(div)=>{this.loadPic = div}} className={SlapfaceLess.loading_anim} style ={{backgroundImage: `url(${this.props.pic_loading})`,width: this.groupArr[this.state.curIndex].width, height: this.groupArr[this.state.curIndex].height,position:"absolute",visibility : this.loadDisplay}}> </div>
251
- <div style={{width: '100%', height: '100%',visibility:this.firstFrameDisplay}}>
252
- <CloseButton btn_closeButton = {this.props.btn_closeButton} elseDisplay = {this.elseDisplay} onClick={(e: Event) => { this.closeClick(e);this.loadDisplay = "hidden" }} />
253
- <JumpButton elseDisplay = {this.elseDisplay} jumpButton = {this.props.jumpButton}/>
254
- </div>
250
+ <div ref={(div)=>{this.picBack = div}} onAnimationEnd={() => {setTimeout(()=>{this.picBack.className = SlapfaceLess.groupBackReverse},0)}}>
251
+ <img src = {this.groupArr[this.state.curIndex].picture} style ={{visibility:this.elseDisplay,width: this.groupArr[this.state.curIndex].width, height: this.groupArr[this.state.curIndex].height}} onLoad = {()=>{let curIndex = this.state.curIndex;if(!this.groupArr[curIndex].isLoadDone) {this.groupArr[curIndex].isLoadDone = true;this.loadDisplay = "hidden";this.elseDisplay = "visible";this.forceUpdate()}}}></img>
252
+ <CloseButton firstFrameDisplay = {this.firstFrameDisplay} btn_closeButton = {this.props.btn_closeButton} elseDisplay = {this.elseDisplay} onClick={(e: Event) => { this.closeClick(e);}} />
253
+ <JumpButton firstFrameDisplay = {this.firstFrameDisplay} elseDisplay = {this.elseDisplay} jumpButton = {this.props.jumpButton}/>
255
254
  </div>
255
+ <div ref={(div)=>{this.loadPic = div}} className={SlapfaceLess.loading_anim} style ={{backgroundImage: `url(${this.props.pic_loading})`,width:"300px", height: "300px",position:"absolute",visibility : this.loadDisplay}}> </div>
256
256
  </div>);
257
257
  }
258
258
 
@@ -262,7 +262,7 @@ class CloseButton extends Component<any, any>
262
262
  {
263
263
  render() {
264
264
  return (
265
- <button className={SlapfaceLess.closeButton} style={{ visibility : this.props.elseDisplay,backgroundSize:"contain",backgroundImage: `url(${this.props.btn_closeButton})` }} onClick={this.props.onClick}></button>
265
+ <button className={SlapfaceLess.closeButton} style={{display:this.props.firstFrameDisplay,visibility : this.props.elseDisplay,backgroundSize:"contain",backgroundImage: `url(${this.props.btn_closeButton})` }} onClick={this.props.onClick}></button>
266
266
  )
267
267
  }
268
268
  }
@@ -272,8 +272,8 @@ class JumpButton extends Component<any, any>
272
272
  private jumpbtnImg
273
273
  render() {
274
274
  return (
275
- <div className= {SlapfaceLess.jumpButton} style ={{visibility : this.props.elseDisplay}}
276
- onMouseDown={() => {(this.jumpbtnImg as HTMLImageElement).src = this.props.jumpButton.pic_yaxia;console.log("yaxia") }}
275
+ <div className= {SlapfaceLess.jumpButton} style ={{display:this.props.firstFrameDisplay,visibility : this.props.elseDisplay}}
276
+ onMouseDown={() => {(this.jumpbtnImg as HTMLImageElement).src = this.props.jumpButton.pic_yaxia;}}
277
277
  onMouseUp={() => { (this.jumpbtnImg as HTMLImageElement).src = this.props.jumpButton.pic_xuanfu }}
278
278
  onMouseOver={() => { (this.jumpbtnImg as HTMLImageElement).src = this.props.jumpButton.pic_xuanfu; }}
279
279
  onMouseOut={() => { (this.jumpbtnImg as HTMLImageElement).src = this.props.jumpButton.pic_changtai; }}>
@@ -15,14 +15,14 @@ let jumpButton = {
15
15
 
16
16
  let btn_closeButton = Images.btn_close
17
17
 
18
- let groupArr = [{ picture: "https://cdn.pixabay.com/photo/2021/03/22/01/55/burger-6113497_1280.jpg", isLoadDone: false, width: 632, height: 639 }, { picture: "https://cdn.pixabay.com/photo/2023/03/07/13/18/fruit-7835730_1280.jpg", isLoadDone: false, width: 304, height: 331 },
19
- { picture: "https://cdn.pixabay.com/photo/2023/03/08/20/52/architecture-7838713_1280.jpg", isLoadDone: false, width: 662, height: 631 }, { picture: "https://cdn.pixabay.com/photo/2023/02/12/13/34/bird-7785106_1280.jpg", isLoadDone: false, width: 728, height: 651 },
20
- { picture: "https://cdn.pixabay.com/photo/2023/03/06/15/45/coffee-7833769_1280.jpg", isLoadDone: false, width: 630, height: 579 }, { picture: "https://cdn.pixabay.com/photo/2013/07/18/20/26/sea-164989_1280.jpg", isLoadDone: false, width: 703, height: 621 }];
18
+ let groupArr = [{ picture: Images.slapface_samplepic1, width: 632, height: 639 }, { picture: Images.slapface_samplepic2, width: 304, height: 331 },
19
+ { picture: Images.slapface_samplepic3, width: 662, height: 631 }, { picture: Images.slapface_samplepic4, width: 728, height: 651 },
20
+ { picture: Images.slapface_samplepic5, width: 630, height: 579 }, { picture: Images.slapface_samplepic6, width: 703, height: 621 }];
21
21
 
22
22
  export class SlapfaceDemo extends Component<any, any>{
23
23
  render() {
24
24
  return (
25
- <div>
25
+ <div style={{position:"relative",width:"100%",height:"100%"}}>
26
26
  <Slapface LoadGroup={groupArr} jumpButton={jumpButton} settingsitems={settingsitems} pic_loading={Images.loading} btn_closeButton = {Images.btn_close}/>
27
27
  </div>
28
28
  )