Adding a delay before positioning the regex
This gives the page time to render the loading indicator before doing all the positioning work; providing a better experience for users when rendering complicated regexs like that Perl email regex.
This commit is contained in:
parent
f81ba6535f
commit
bc84f68250
@ -81,9 +81,7 @@ export default class Regexper {
|
||||
|
||||
renderRegexp(expression) {
|
||||
var snap = Snap(this.svg),
|
||||
deferred = Q.defer(),
|
||||
padding = this.padding,
|
||||
result;
|
||||
padding = this.padding;
|
||||
|
||||
snap.selectAll('g').remove();
|
||||
|
||||
@ -95,6 +93,9 @@ export default class Regexper {
|
||||
return result;
|
||||
}, this.showError.bind(this))
|
||||
.then((result) => {
|
||||
var deferred = Q.defer();
|
||||
|
||||
setTimeout(() => {
|
||||
var box;
|
||||
|
||||
result.position();
|
||||
@ -106,6 +107,11 @@ export default class Regexper {
|
||||
width: box.width + padding * 2,
|
||||
height: box.height + padding * 2
|
||||
});
|
||||
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user