Improved pasting images on retina devices.
This commit is contained in:
parent
3375163c9c
commit
0a3bdffc93
3 changed files with 18 additions and 5 deletions
|
@ -19,6 +19,7 @@ class App.ImageService
|
|||
imageObject.onload = ->
|
||||
imageWidth = imageObject.width
|
||||
imageHeight = imageObject.height
|
||||
console.log('ImageService', 'current size', imageWidth, imageHeight)
|
||||
if y is 'auto' && x is 'auto'
|
||||
x = imageWidth
|
||||
y = imageHeight
|
||||
|
@ -68,10 +69,10 @@ class App.ImageService
|
|||
newDataUrl = canvas.toDataURL(type, quallity)
|
||||
if resize
|
||||
console.log('ImageService', 'resize', x/sizeFactor, y/sizeFactor, quallity, (newDataUrl.length * 0.75)/1024/1024, 'in mb')
|
||||
callback(newDataUrl, x/sizeFactor, y/sizeFactor)
|
||||
callback(newDataUrl, x/sizeFactor, y/sizeFactor, true)
|
||||
return
|
||||
console.log('ImageService', 'no resize', x, y, quallity, (newDataUrl.length * 0.75)/1024/1024, 'in mb')
|
||||
callback(newDataUrl, x, y)
|
||||
callback(newDataUrl, x, y, false)
|
||||
|
||||
# load image from data url
|
||||
imageObject.src = dataURL
|
||||
|
|
|
@ -221,8 +221,14 @@
|
|||
var img = document.createElement('img')
|
||||
img.src = result
|
||||
|
||||
insert = function(dataUrl, width, height) {
|
||||
insert = function(dataUrl, width, height, isRetina) {
|
||||
//console.log('dataUrl', dataUrl)
|
||||
|
||||
// adapt image if we are on retina devices
|
||||
if (!isRetina && window.isRetina && window.isRetina()) {
|
||||
width = width / 2
|
||||
height = height / 2
|
||||
}
|
||||
_this.log('image inserted')
|
||||
result = dataUrl
|
||||
img = "<img style=\"width: " + width + "px; height: " + height + "px\" src=\"" + result + "\">"
|
||||
|
@ -330,7 +336,13 @@
|
|||
img.src = result
|
||||
|
||||
//Insert the image at the carat
|
||||
insert = function(dataUrl, width, height) {
|
||||
insert = function(dataUrl, width, height, isRetina) {
|
||||
|
||||
// adapt image if we are on retina devices
|
||||
if (!isRetina && window.isRetina && window.isRetina()) {
|
||||
width = width / 2
|
||||
height = height / 2
|
||||
}
|
||||
|
||||
//console.log('dataUrl', dataUrl)
|
||||
_this.log('image inserted')
|
||||
|
|
|
@ -1677,7 +1677,7 @@ wait untill text in selector disabppears
|
|||
)
|
||||
|
||||
found = false
|
||||
(1..4).each {
|
||||
(1..8).each {
|
||||
element = instance.find_elements(css: '.active .newTicket')[0]
|
||||
if element
|
||||
found = true
|
||||
|
|
Loading…
Reference in a new issue