Mocking interfaces (+adding new method to canvas to make it more JS-like)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
885d1f5dc3
commit
4c1b705240
11 changed files with 216 additions and 13 deletions
|
@ -36,7 +36,7 @@ Canvas {
|
|||
width: parent.width
|
||||
/*!
|
||||
\qmlproperty var LogGraphCanvas::imageLoaders
|
||||
Dictionary of format {image: [callback.image data]} containing data for defered image loading.
|
||||
Dictionary of format {image: callback} containing data for deferred image loading.
|
||||
*/
|
||||
property var imageLoaders: {}
|
||||
|
||||
|
@ -66,9 +66,21 @@ Canvas {
|
|||
Object.keys(imageLoaders).forEach((key) => {
|
||||
if(isImageLoaded(key)) {
|
||||
// Calling callback
|
||||
imageLoaders[key][0](imageLoaders[key][1])
|
||||
imageLoaders[key]()
|
||||
delete imageLoaders[key]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/*!
|
||||
\qmlmethod void LogGraphCanvas::loadImageAsync(string imageSource)
|
||||
Loads an image data onto the canvas asynchronously.
|
||||
Returns a Promise that is resolved when the image is loaded.
|
||||
*/
|
||||
function loadImageAsync(imageSource) {
|
||||
return new Promise((resolve) => {
|
||||
this.loadImage(imageSource)
|
||||
this.imageLoaders[imageSource] = resolve
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -257,13 +257,11 @@ ApplicationWindow {
|
|||
})
|
||||
Modules.IO.on("saved loaded", (evt) => {
|
||||
// Refreshing sidebar
|
||||
console.log(evt.name)
|
||||
updateObjectsLists()
|
||||
if(title.endsWith("*"))
|
||||
title = title.substring(0, title.length-1)
|
||||
})
|
||||
Modules.IO.on("modified", () => {
|
||||
console.log("modified")
|
||||
if(!title.endsWith("*"))
|
||||
title = title+"*"
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue