Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_cropModalEvent(e){
e.preventDefault();
console.log(e.pageX, this.config.imgLeft);
this.config.X = e.pageX - this.config.imgLeft;
this.config.Y = e.pageY - this.config.imgTop;
this.config.cache = { x: e.pageX, y: e.pageY };
this.listenList._cropModalMove = listen(document.body, 'mousemove', this._cropModalMove);
this.listenList._cropModalMouseup = listen(document.body, 'mouseup', this._cropModalMouseup);
}
_formSubmit(){
let _validate = e => {
e && e.preventDefault();
this._validate(true);
this._validateState();
this.options.focusError && this._focus();
let flag = Object.keys(this.config.validateState).every(item => {
return this.config.validateState[item]
});
flag && this.options.submitHandler(this.options.container);
}
listen(this.options.container, 'submit', _validate);
}
} else if (item.value > rule.max) {
this._errorMsg(item, rule.message || this.options.errorMsg.maxMsg(rule.max));
} else {
this._removeError(item);
}
} else if (rule.regex) {
if(this.config.errorDom[item.name]) return;
if(!new RegExp(rule.regex).test(item.value)){
this._errorMsg(item, rule.message || this.options.errorMsg.regexMsg(rule.regex));
} else {
this._removeError(item);
}
}
}
submit && _event() || listen(item, rule.trigger, _event);
}
_eventBind(){
this.listenList._cropModalEvent = listen(this.cropModal, 'mousedown', this._cropModalEvent);
this.listenList._cropBoxEvent = listen(this.cropModal, 'mousedown', this._cropBoxEvent);
}
_listen(el, type, event) {
this.listeners.push(listen(el, type, event));
}
}
listenClick(trigger) {
this.listener = listen(trigger, 'click', (e) => this.onClick(e));
}
listenClick(trigger) {
this.listener = listen(trigger, 'click', (e) => this.onClick(e));
}