Skip to content

Commit

Permalink
Images display immediately after upload
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelgira23 committed Jan 10, 2017
1 parent e73c206 commit c626039
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/app/shared/model/whiteboard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,6 @@ export class WhiteboardService {
this.observableToPromise(this.sdkStorage.child(`whiteboardFiles/${whiteboardKey}/${pushKey}`).put(file))
.subscribe((uploadedImage: any) => {
// Add image object to the whiteboard
// return this.af.database.object(`whiteboards/${whiteboardKey}`).update({ snapshot: uploadedImage.metadata.downloadURLs[0] });
console.log('uplaod image', uploadedImage);
const whiteboardImage: WhiteboardImage = {
created: firebase.database['ServerValue']['TIMESTAMP'],
createdBy: this.authInfo ? this.authInfo.uid : null,
Expand Down
14 changes: 5 additions & 9 deletions src/app/whiteboard/whiteboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,11 @@ export class WhiteboardComponent implements OnInit, OnChanges, OnDestroy {
// Get options for current image
let paperOptions = {
rotation: image.rotation,
source: image.url
source: image.url,
x: image.bounds.x,
y: image.bounds.y,
width: image.bounds.width,
height: image.bounds.height
};

// Check if image already exists on whiteboard
Expand All @@ -843,15 +847,9 @@ export class WhiteboardComponent implements OnInit, OnChanges, OnDestroy {
this.canvasImages[image.$key].bounds = rectangles.deserialize(image.bounds);
} else if (!image.erased) {
// Create new marking on whiteboard
console.log('image url', image.url);
this.canvasImages[image.$key] = new paper.Raster(paperOptions);
// Set bounds here because it doesn't work in object init for some reason
this.canvasImages[image.$key].bounds = rectangles.deserialize(image.bounds);

this.canvasImages[image.$key].onLoad = () => {
console.log('imageh has loaded', image.url);
console.log(this.canvasImages[image.$key]);
};
}
}

Expand Down Expand Up @@ -965,8 +963,6 @@ export class WhiteboardComponent implements OnInit, OnChanges, OnDestroy {
let editImages = [];

items.forEach(item => {
console.log('ite', item);

// Get key from marking and text
const markingKey = this.markingIdToPushKey(item.id);
const textKey = this.textIdToPushKey(item.id);
Expand Down

0 comments on commit c626039

Please sign in to comment.