mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Fix image with same pathname not updated
&& add boolean in onechange
This commit is contained in:
parent
d85554b032
commit
011949e757
@ -29,6 +29,8 @@ class ImageController extends Controller {
|
|||||||
constructor(object, property) {
|
constructor(object, property) {
|
||||||
super(object, property);
|
super(object, property);
|
||||||
|
|
||||||
|
this.__onChangeFirstTime = true;
|
||||||
|
|
||||||
this.__fileReader = new FileReader();
|
this.__fileReader = new FileReader();
|
||||||
|
|
||||||
const _this = this;
|
const _this = this;
|
||||||
@ -62,7 +64,8 @@ class ImageController extends Controller {
|
|||||||
_this.__imagePreview.src = _this.__image.src;
|
_this.__imagePreview.src = _this.__image.src;
|
||||||
|
|
||||||
if (_this.__onChange) {
|
if (_this.__onChange) {
|
||||||
_this.__onChange.call(_this, _this.__image);
|
_this.__onChange.call(_this, _this.__image, _this.__onChangeFirstTime);
|
||||||
|
_this.__onChangeFirstTime = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,6 +74,7 @@ class ImageController extends Controller {
|
|||||||
if (!file) {
|
if (!file) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
_this.__input.value = '';
|
||||||
_this.__fileReader.readAsDataURL(file);
|
_this.__fileReader.readAsDataURL(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user