Skip to content

Commit

Permalink
proper dragging and icon
Browse files Browse the repository at this point in the history
  • Loading branch information
altin-mapme committed Jan 28, 2020
1 parent 233a9f2 commit 490cff6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Binary file modified build/icons/icon.ico
Binary file not shown.
9 changes: 1 addition & 8 deletions src/renderer/components/ChatHead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
multiple: filteredImages.length > 1,
}"
@mousedown="handleMouseDown"
@mousemove="handleMouseMove"
@mouseup="handleMouseUp"
@dblclick="hideChatHead"
>
Expand Down Expand Up @@ -79,33 +78,27 @@ export default {
},
data: () => ({
isDragging: false,
delta: 10,
delta: 50,
startX: null,
startY: null,
}),
methods: {
handleMouseDown(event) {
this.isDragging = false;
this.startX = event.pageX;
this.startY = event.pageY;
},
handleMouseMove() {
this.isDragging = true;
},
handleMouseUp(event) {
const { delta, startX, startY, isDragging, hidden } = this;
const diffX = Math.abs(event.pageX - startX);
const diffY = Math.abs(event.pageY - startY);
if (
isDragging === false &&
diffX < delta &&
diffY < delta &&
!hidden
) {
this.$emit('select');
}
this.isDragging = false;
},
hideChatHead() {
this.$emit('hide');
Expand Down
12 changes: 11 additions & 1 deletion src/renderer/views/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default {
ipcRenderer.removeAllListeners('update_downloaded');
this.updateAvailable = true;
});
ipcRenderer.on('checking_update', (value) => {
ipcRenderer.on('checking_update', value => {
console.log('Checking for update: ', value);
ipcRenderer.removeAllListeners('checking_update');
});
Expand Down Expand Up @@ -271,6 +271,16 @@ export default {
}
},
updateChats(stringifiedChats) {
if (this.heads === null) {
// workaround for initial chat window scroll
// position set to middle (for some reeason)
const webview = document.querySelector('#messengerWebView');
setTimeout(() => {
webview.executeJavaScript(`
scrollToBottom();
`);
}, 1000);
}
this.heads = JSON.parse(stringifiedChats);
},
updateLayout() {
Expand Down
Binary file modified static/icon.ico
Binary file not shown.

0 comments on commit 490cff6

Please sign in to comment.