302,6,156,54,755,55,496,18,1947,41,412,40,347,34,113,37,488,37,368,25,918,42,514,30,457,30,212,30,625,27,1095,36,707,71,162,56,427,59,144,71,162,56,344,59,143,43,1693,40,403,34,323,32,624,42,303,32,124,32,210,40,180,29,996,51,168,31,1109,37,735,43,966,35,603,39,134,41,1065,43,213,51,205,49,199,47,251
_info
{"project":"gui-components","branch":"master","version":20,"versionDate":"2024-05-22T13:19:31.000Z","fromVersion":0,"reset":true,"checksumDocs":"41-22957"}
customImage/_shared/getMobileCameraPluginImage/get.ls
(function(){
return function(params){
var options, onSuccess, onError;
options = {
targetWidth: params.width || 1000,
targetHeight: params.height || 1000,
cameraDirection: params.direction === "front" ? 1 : 0,
encodingType: params.encoding === "png" ? 1 : 0,
sourceType: params.source === "camera" ? 1 : 0,
destinationType: 0,
correctOrientation: true
};
onSuccess = function(base64){
var mime, dataUrl;
if (params.encoding === "png") {
mime = "image/png";
} else {
mime = "image/jpg";
}
dataUrl = "data:" + mime + ";base64," + base64;
return params.onSelected(dataUrl);
};
onError = function(error){
return typeof params.onError == 'function' ? params.onError(error) : void 8;
};
return navigator.camera.getPicture(onSuccess, onError, options);
};
})();
customImage/_shared/hiddenFileInput/hiddenFileInput.ls
(function(){
return function(params){
var onChange, input;
onChange = function(e){
var file;
file = input.files[0];
return params.onSelected(file);
};
input = Input().attr({
type: "file",
accept: params.imageOnly ? "image/jpg,image/jpeg,image/png,image/x-png,image/gif,image/bmp" : void 8
}).css({
position: "absolute",
top: 0,
left: 0,
bottom: 0,
right: 0,
opacity: 0
});
input.addEventListener("change", onChange);
input.selectFile = function(){
return input.click();
};
return input;
};
})();
customImage/_t.ls
(function(){
return {
camera: {
de: "Kamera verwenden",
en: "Use your camera",
fr: "Utiliser la caméra",
es: "Utilizar la cámara",
pt: "Utilizar a câmera"
},
file: {
de: "Datei auswählen",
en: "Select a file",
fr: "Choisir un fichier",
es: "Elegir archivo",
pt: "Escolher arquivo"
},
info: {
de: "Du kannst auch ein Bild aus der
Zwischenablage einfügen oder
eine Datei hier hineinziehen.",
en: "You can paste an image from the clipboard or drag and drop a file here.",
fr: "Tu peux aussi coller une image
à l'aide du presse-papiers
ou déposer un fichier ici.",
es: "También puedes agregar una imagen del portapapeles o arrastrar un archivo hasta aquí.",
pt: "Você também pode colar uma imagem da área copiada ou arrastar um arquivo até aqui."
},
cameraAccessError: {
de: "Diese Funktion benötigt
Zugriff auf die Kamera.
",
en: "This function requires
access to your camera.
",
fr: "Cette fonction nécessite
l'accès à ta caméra.
",
es: "Esta función requiere
acceso a la cámara.
",
pt: "Esta função requer
acesso à câmera.
"
},
pluginMissing: {
de: "Diese Funktion benötigt
eine neuere Version der App.
",
en: "This function requires
a newer version of the app.
",
fr: "Cette fonction nécessite
une version plus récente de l'application.
",
es: "Esta función requiere
una versión más actual de la aplicación.
",
pt: "Esta função requer
uma versão mais atualizada do aplicativo.
"
},
mobileBrowserError: {
de: "Diese Funktion benötigt
die ANTON-App oder
einen Desktop-Browser.",
en: "This function requires
the ANTON app or
a desktop browser.",
fr: "Cette fonction nécessite
l'application ANTON ou
un navigateur web.",
es: "Esta función requiere
ANTON-App
o un navegador de escritorio.",
pt: "Esta função requer
ANTON-App
ou um navegador de desktop."
}
};
})();
customImage/crop/buttonConfirm/button.ls
(function(){
return function(o){
var tap;
if (!o.onSuccess) {
return;
}
tap = function(){
return o.onSuccess(o.getDataUrl());
};
return Div({
padding: "0.7em",
position: "absolute",
bottom: 0,
left: 0,
display: "flex",
borderRadius: o.isRound ? "999px" : void 8,
overflow: "hidden",
backgroundColor: Color.grey[600]
}).html(SvgIcon({
svg: o.svgPaths.check,
color: Color.white,
size: "1em"
})).tap(tap);
};
})();
customImage/crop/buttonDelete/button.ls
(function(){
return function(o){
var tap;
tap = function(){
return o.onCancel();
};
return Div({
display: "flex",
position: "absolute",
bottom: 0,
left: 0,
padding: "0.7em",
backgroundColor: Color.grey[600],
borderRadius: o.isRound ? "999px" : void 8
}).html(SvgIcon({
svg: o.svgPaths.trash,
color: Color.white,
size: "1em"
})).tap(tap);
};
})();
customImage/crop/center/center.ls
(function(){
return function(o){
return function(){
inc("zoom/zoom")(o);
return inc("move/move")(o);
};
};
})();
customImage/crop/center/move/move.ls
(function(){
return function(o){
var dx, dy;
if (o.imageRatio < 1) {
o.imageWidth = o.containerSize;
o.imageHeight = _.round(o.containerSize / o.imageRatio);
dx = -1 * o.container.scrollLeft;
dy = (o.imageHeight - o.imageWidth) / 2 - o.container.scrollTop;
} else {
o.imageHeight = o.containerSize;
o.imageWidth = _.round(o.containerSize * o.imageRatio);
dy = -1 * o.container.scrollTop;
dx = (o.imageWidth - o.imageHeight) / 2 - o.container.scrollLeft;
}
return o.move(dx, dy);
};
})();
customImage/crop/center/zoom/zoom.ls
(function(){
return function(o){
var dz;
if (o.imageRatio < 1) {
o.imageWidth = o.containerSize;
o.imageHeight = _.round(o.containerSize / o.imageRatio);
dz = o.imageWidth - o.imageOriginalWidth;
} else {
o.imageHeight = o.containerSize;
o.imageWidth = _.round(o.containerSize * o.imageRatio);
dz = o.imageHeight - o.imageOriginalHeight;
}
return o.zoom(dz);
};
})();
customImage/crop/crop.ls
(function(){
return function(params){
var o;
o = params;
o.size == null && (o.size = "15em");
o.getDataUrl = inc("getDataUrl/getDataUrl")(o);
o.move = inc("move/move")(o);
o.zoom = inc("zoom/zoom")(o);
o.center = inc("center/center")(o);
o.div = Div().css({
display: "inline-flex",
width: o.size,
height: o.size,
pointerEvents: "none",
flexDirection: "column"
}).html(o.container = Div().css({
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
overflow: "hidden",
lineHeight: 0,
borderRadius: o.isRound ? "999px" : void 8,
border: "1px solid " + Color.grey[350],
background: Color.grey[75]
}).html(o.image = Img().attr({
src: o.dataUrl
}).css({
opacity: 0
})), inc("buttonDelete/button")(o), inc("buttonConfirm/button")(o));
o.div.getDataUrl = o.getDataUrl;
o.div.move = o.move;
o.div.zoom = o.zoom;
o.div.center = o.center;
o.image.onload = function(){
return inc("init/init")(o);
};
return o.div;
};
})();
customImage/crop/getDataUrl/getDataUrl.ls
(function(){
return function(o){
return function(){
var scale, size, x, y, canvas, ctx, dataUrl;
scale = o.imageWidth / o.imageOriginalWidth;
size = _.round(o.containerSize / scale);
x = _.round(o.container.scrollLeft / scale);
y = _.round(o.container.scrollTop / scale);
canvas = document.createElement('canvas');
ctx = canvas.getContext('2d');
canvas.width = size;
canvas.height = size;
ctx.drawImage(o.image, x, y, size, size, 0, 0, size, size);
return dataUrl = canvas.toDataURL("image/png", 0.9);
};
};
})();
customImage/crop/init/init.ls
(function(){
return function(o){
o.div.css({
pointerEvents: ""
});
o.containerSize = o.container.offsetWidth;
o.imageOriginalWidth = o.image.offsetWidth;
o.imageOriginalHeight = o.image.offsetHeight;
o.imageRatio = _.round(o.imageOriginalWidth / o.imageOriginalHeight, 2);
o.center();
o.image.css({
opacity: 1
});
return inc("/gestureZoomMove/gestureZoomMove")({
div: o.container,
onZoom: o.zoom,
onMove: o.move,
isTouchDevice: o.isTouchDevice
});
};
})();
customImage/crop/move/move.ls
(function(){
return function(o){
return function(dx, dy){
if (!(dx || dy)) {
return;
}
o.container.scrollLeft = o.container.scrollLeft + dx;
return o.container.scrollTop = o.container.scrollTop + dy;
};
};
})();
customImage/crop/zoom/zoom.ls
(function(){
return function(o){
return function(dz){
var w, dx, dy, h;
if (!dz) {
return;
}
if (o.imageRatio < 1) {
w = o.imageWidth + dz;
if (w >= o.containerSize && w <= o.imageOriginalWidth) {
dx = dz;
dy = _.round(dx / o.imageRatio);
o.imageWidth += dx;
o.imageHeight += dy;
}
} else {
h = o.imageHeight + dz;
if (h >= o.containerSize && h <= o.imageOriginalHeight) {
dy = dz;
dx = _.round(dy * o.imageRatio);
o.imageWidth += dx;
o.imageHeight += dy;
}
}
o.move(dx / 2, dy / 2);
o.scale = o.imageWidth / o.imageOriginalWidth;
return o.image.css({
width: o.imageWidth + "px",
height: o.imageHeight + "px"
});
};
};
})();
customImage/customImage.ls
(function(){
return function(params){
var o, onCancel, onSelect;
params == null && (params = {});
o = params;
o.size == null && (o.size = "15em");
onCancel = function(){
var ref$, ref1$;
if (typeof o.onCanceled == 'function') {
o.onCanceled();
}
o.div.html(inc("select/select")({
onSuccess: onSelect,
svgPaths: params.svgPaths,
isMobileApp: params.isMobileApp,
isDesktop: params.isDesktop,
isRound: params.isRound,
size: params.size
}));
return ref1$ = (ref$ = o.div).getDataUrl, delete ref$.getDataUrl, ref1$;
};
onSelect = function(dataUrl){
var div;
if (typeof o.onSelected == 'function') {
o.onSelected(dataUrl);
}
o.div.html(div = inc("crop/crop")({
dataUrl: dataUrl,
svgPaths: params.svgPaths,
isTouchDevice: params.isTouchDevice,
onSuccess: params.onCropped,
onCancel: onCancel,
isRound: params.isRound,
size: params.size
}));
return o.div.getDataUrl = div.getDataUrl;
};
return o.div = Div().html(inc("select/select")({
onSuccess: onSelect,
svgPaths: params.svgPaths,
isMobileApp: params.isMobileApp,
isDesktop: params.isDesktop,
isRound: params.isRound,
size: params.size
}));
};
})();
customImage/select/camera/camera.ls
(function(){
return function(o){
var tap;
if (!navigator.camera && !navigator.mediaDevices.getUserMedia || o.isMobileBrowser) {
return;
}
tap = function(){
if (navigator.camera) {
return inc("../../_shared/getMobileCameraPluginImage/get")({
onSelected: o.onSuccess,
format: "file",
source: "camera"
});
} else if (o.isMobileApp) {
return o.errorDiv.show().setError(T("pluginMissing"));
} else {
return inc("webcam/webcam")(o);
}
};
return Div().css({
color: Color.blue[700],
textDecoration: "underline",
display: "inline-flex",
padding: "0.1em 0.2em",
marginTop: "1em"
}).html(SvgIcon({
svg: o.svgPaths.camera,
color: Color.blue[700]
}).css({
margin: "0.05em 0.15em 0 0"
}), T("camera")).tap(tap);
};
})();
customImage/select/camera/webcam/buttonCamera/background/background.ls
(function(){
return function(){
return Div().css({
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
background: Color.black,
opacity: 0.7
});
};
})();
customImage/select/camera/webcam/buttonCamera/button.ls
(function(){
return function(o, close){
var tap;
tap = function(){
return o.getWebcamImageBlobUrl(function(blobUrl){
var base64;
base64 = o.getWebcamImage();
o.onSuccess(base64, blobUrl);
return close();
});
};
return Div({
position: "absolute",
bottom: 0,
right: 0,
display: "flex",
borderRadius: o.isRound ? "999px" : void 8,
overflow: "hidden"
}).html(inc("background/background")(), inc("icon/icon")(o)).tap(tap);
};
})();
customImage/select/camera/webcam/buttonCamera/icon/icon.ls
(function(){
return function(o){
return SvgIcon({
svg: o.svgPaths.camera,
color: Color.white,
size: "1em"
}).css({
margin: "0.7em"
});
};
})();
customImage/select/camera/webcam/buttonCancel/background/background.ls
(function(){
return function(){
return Div().css({
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
background: Color.black,
opacity: 0.7
});
};
})();
customImage/select/camera/webcam/buttonCancel/button.ls
(function(){
return function(o, close){
return Div().css({
position: "absolute",
bottom: 0,
left: 0,
display: "flex",
borderRadius: o.isRound ? "999px" : void 8,
overflow: "hidden"
}).html(inc("background/background")(), inc("icon/icon")(o)).tap(function(){
close();
return typeof o.onCancel == 'function' ? o.onCancel() : void 8;
});
};
})();
customImage/select/camera/webcam/buttonCancel/icon/icon.ls
(function(){
return function(o){
return SvgIcon({
svg: o.svgPaths.close,
color: Color.white,
size: "1em"
}).css({
margin: "0.7em"
});
};
})();
customImage/select/camera/webcam/webcam.ls
(function(){
return function(o){
var init, disable, close, div, video;
init = function(){
return navigator.mediaDevices.getUserMedia({
audio: false,
video: {
width: {
ideal: 2000
},
height: {
ideal: 2000
}
}
}).then(function(stream){
video.srcObject = stream;
return o.div.append(div);
})['catch'](function(e){
if (o.onError) {
return o.onError(e);
} else {
o.errorDiv.show().setError(T("cameraAccessError"));
return o.infoDiv.hide();
}
});
};
disable = function(){
return video.srcObject.getVideoTracks().forEach(function(track){
return track.stop();
});
};
close = function(){
return div.remove();
};
o.getWebcamImage = function(){
var c, ctx, w, h, dataUrl;
c = document.createElement("canvas");
ctx = c.getContext("2d");
w = video.videoWidth;
h = video.videoHeight;
c.width = w;
c.height = h;
ctx.drawImage(video, 0, 0, w, h, 0, 0, w, h);
return dataUrl = c.toDataURL("image/jpeg", 0.9);
};
o.getWebcamImageBlobUrl = function(onDone){
var c, ctx, w, h;
c = document.createElement("canvas");
ctx = c.getContext("2d");
w = video.videoWidth;
h = video.videoHeight;
c.width = w;
c.height = h;
ctx.drawImage(video, 0, 0, w, h, 0, 0, w, h);
return c.toBlob(function(blob){
return onDone(URL.createObjectURL(blob));
}, "image/jpeg", 0.9);
};
div = Div().css({
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0
}).html(video = Video().attr({
width: "100%",
height: "100%",
autoplay: true
}).css({
objectFit: "cover",
overflow: "hidden",
transform: "scaleX(-1)",
borderRadius: o.isRound ? "999px" : void 8,
background: Color.grey[75]
}), inc("buttonCancel/button")(o, close), inc("buttonCamera/button")(o, close));
div.onDomRemove(function(){
return disable();
});
return init();
};
})();
customImage/select/dropZone/dropZone.ls
(function(){
return function(o){
if (o.isMobileApp || o.isMobileBrowser) {
return;
}
return inc("/fileInput/dropZone/dropZone")({
onSelected: o.onSelected,
imageOnly: true,
onSetActive: function(){
return o.div.setDropActive();
},
onSetInactive: function(){
return o.div.setDropInactive();
}
}).css({
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
cursor: "default !important"
});
};
})();
customImage/select/error/error.ls
(function(){
return function(o){
var tap, div;
tap = function(){
o.errorDiv().hide();
return o.infoDiv().show();
};
div = Div().css({
color: Color.red[500],
fontSize: "0.8em",
pointerEvents: "none"
}).tap(tap).hide();
div.setError = function(error){
return div.html(error).show();
};
o.errorDiv = div;
return div;
};
})();
customImage/select/file/file.ls
(function(){
return function(o){
var tap;
if (o.isMobileBrowser) {
return;
}
tap = function(){
if (navigator.camera) {
return inc("../../_shared/getMobileCameraPluginImage/get")({
onSelected: o.onSuccess,
format: "file"
});
} else if (o.isMobileApp) {
return o.errorDiv.show().setError(T("pluginMissing"));
} else {
return o.hiddenInput.selectFile();
}
};
return Div({
color: Color.blue[700],
textDecoration: "underline",
display: "inline-flex",
padding: "0.1em 0.2em",
marginBottom: "1em"
}).html(SvgIcon({
svg: o.svgPaths.open,
color: Color.blue[700]
}).css({
margin: "0.05em 0.15em 0 0"
}), T("file")).tap(tap);
};
})();
customImage/select/fileinput/fileInput.ls
(function(){
return function(o){
var div;
if (navigator.camera || o.isMobileBrowser) {
return;
}
div = inc("/fileInput/hiddenInput/hiddenInput")({
onSelected: o.onSelected,
imageOnly: true
}).css({
position: "absolute",
top: 0,
left: 0,
bottom: 0,
right: 0
});
o.hiddenInput = div;
return div;
};
})();
customImage/select/icon/icon.ls
(function(){
return function(){
return SvgIcon({
svg: o.svgPaths.image,
color: Color.grey[300],
size: "2.75em"
});
};
})();
customImage/select/info/info.ls
(function(){
return function(o){
if (o.isMobileApp || o.isMobileBrowser) {
return;
}
return o.infoDiv = Div().html(T("info")).css({
color: Color.grey[400],
fontSize: "0.8em",
pointerEvents: "none"
});
};
})();
customImage/select/pasteDiv/pasteDiv.ls
(function(){
return function(o){
if (o.isMobileApp || o.isMobileBrowser) {
return;
}
return inc("/fileInput/hiddenPasteDiv/hiddenPasteDiv")({
onSelected: o.onSelected
});
};
})();
customImage/select/select.ls
(function(){
return function(params){
var o;
o = params;
o.size == null && (o.size = "15em");
o.onSelected = function(file){
var reader;
reader = new FileReader;
reader.readAsDataURL(file);
return reader.onloadend = function(){
return o.onSuccess(reader.result);
};
};
o.isMobileBrowser = !o.isDesktop && !o.isMobileApp;
o.div = Div().css({
display: "inline-flex",
width: o.size,
height: o.size,
flexDirection: "column",
borderRadius: o.isRound ? "999px" : void 8,
border: "1px solid " + Color.grey[350],
background: Color.grey[75]
}).append(inc("fileinput/fileInput")(o), inc("pasteDiv/pasteDiv")(o), inc("dropZone/dropZone")(o), inc("camera/camera")(o), inc("file/file")(o), inc("error/error")(o), inc("info/info")(o));
o.div.setDropActive = function(){
return o.div.css({
background: Color.grey[150]
});
};
o.div.setDropInactive = function(){
return o.div.css({
background: Color.grey[150]
});
};
if (o.isMobileBrowser) {
o.errorDiv.setError(T("mobileBrowserError"));
}
return o.div;
};
})();
fileInput/_shared/imageMimeTypes/imageMimeTypes.ls
(function(){
return function(){
var imageMimeTypes;
return imageMimeTypes = ["image/jpg", "image/jpeg", "image/png", "image/x-png", "image/gif", "image/bmp"];
};
})();
fileInput/dropZone/dropZone.ls
(function(){
return function(params){
var isAllowedImageFile, onDragenter, onDragleave, onDragover, onDrop, div;
isAllowedImageFile = function(mimeType){
var mimeTypes;
if (!(params.imageOnly || params.mimeTypes)) {
return true;
}
mimeTypes = params.imageOnly
? inc("../_shared/imageMimeTypes/imageMimeTypes")()
: params.mimeTypes ? params.mimeTypes : void 8;
return _.includes(mimeTypes, mimeType);
};
onDragenter = function(e){
e.preventDefault();
return params.onSetActive();
};
onDragleave = function(e){
e.preventDefault();
return params.onSetInactive();
};
onDragover = function(e){
e.preventDefault();
return params.onSetActive();
};
onDrop = function(e){
var file;
e.preventDefault();
file = _.first(e.dataTransfer.files);
if (!(params.imageOnly && !isAllowedImageFile(file.type))) {
params.onSelected(file);
}
return params.onSetInactive();
};
div = params.div || Div();
div.addEventListener('dragenter', onDragenter, false);
div.addEventListener('dragleave', onDragleave, false);
div.addEventListener('dragover', onDragover, false);
div.addEventListener('drop', onDrop, false);
return div;
};
})();
fileInput/hiddenInput/hiddenInput.ls
(function(){
return function(params){
var onChange, calcAccept, input, that;
onChange = function(e){
var file;
file = input.files[0];
return params.onSelected(file);
};
calcAccept = function(mimeTypes){
return _.map(mimeTypes, function(mimeType){
return "." + _.last(mimeType.split("/"));
}).join(",");
};
input = Input().attr({
type: "file",
accept: params.imageOnly
? calcAccept(inc("../_shared/imageMimeTypes/imageMimeTypes")())
: params.mimeTypes ? calcAccept(params.mimeTypes) : void 8
}).hide();
input.ignoreGhostMouseEvents = false;
input.addEventListener("change", onChange);
if (that = params.onCancel) {
input.addEventListener("cancel", that);
}
input.selectFile = function(){
return input.click();
};
return input;
};
})();
fileInput/hiddenPasteDiv/hiddenPasteDiv.ls
(function(){
return function(params){
var onDomRemove, onDomAppend, div;
onDomRemove = function(){
return document.onpaste = null;
};
onDomAppend = function(){
return document.onpaste = function(e){
var ref$, ref1$, files, file, that, mimeTypes, text;
if (((ref$ = e.target) != null ? (ref1$ = ref$.nodeName) != null ? ref1$.toLowerCase() : void 8 : void 8) === "input") {
return;
}
files = (e.clipboardData || e.originalEvent.clipboardData).items;
file = _.first(files);
if (that = file.getAsFile()) {
mimeTypes = params.imageOnly
? inc("../_shared/imageMimeTypes/imageMimeTypes")()
: params.mimeTypes ? params.mimeTypes : void 8;
if ((params.imageOnly || params.mimeTypes) && !_.includes(mimeTypes, file.type)) {
return;
}
file = that;
return params.onSelected(file);
} else {
text = e.clipboardData.getData("text");
return params.onSelected(null, text);
}
};
};
div = Div().hide();
div.onDomAppend(onDomAppend);
div.onDomRemove(onDomRemove);
return div;
};
})();
gestureZoomMove/gestureZoomMove.ls
(function(){
return function(o){
o.div.bind("touchstart mousedown", inc("onDragStart/onDragStart")(o));
o.div.bind("touchend mouseup touchcancel", inc("onDragEnd/onDragEnd")(o));
o.div.bind("touchmove mousemove", inc("onDragMove/onDragMove")(o));
o.div.bind("gesturestart", inc("onGestureStart/onGestureStart")(o));
o.div.bind("gesturechange", inc("onGestureChange/onGestureChange")(o));
o.div.bind("wheel", inc("onWheelChange/onWheelChange")(o));
o.div.bind("contextmenu", function(e){
return e.preventDefault();
});
return o.div.bind("gestureend", function(e){
return e.preventDefault();
});
};
})();
gestureZoomMove/onDragEnd/onDragEnd.ls
(function(){
return function(o){
return function(e){
if (e.cancelable) {
e.preventDefault();
}
return o.isMoving = false;
};
};
})();
gestureZoomMove/onDragMove/onDragMove.ls
(function(){
return function(o){
return function(e){
var isTouchDevice, ref$, r, ref1$, x1, y1, x2, y2, x, y, z, dz, dx, dy;
if (e.cancelable) {
e.preventDefault();
}
if (!o.isMoving) {
return;
}
isTouchDevice = o.isTouchDevice;
if (((ref$ = e.targetTouches) != null ? ref$.length : void 8) > 1 && !isTouchDevice) {
return;
}
r = o.div.getBoundingClientRect();
if (((ref1$ = e.targetTouches) != null ? ref1$.length : void 8) > 1) {
x1 = e.targetTouches[0].pageX - r.left;
y1 = e.targetTouches[0].pageY - r.top;
x2 = e.targetTouches[1].pageX - r.left;
y2 = e.targetTouches[1].pageY - r.top;
x = (x1 + x2) / 2;
y = (y1 + y2) / 2;
z = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
dz = (z - o.prevZ) * 2;
o.prevZ = z;
o.onZoom(dz);
} else {
if (e.targetTouches) {
x = e.targetTouches[0].pageX - r.left;
y = e.targetTouches[0].pageY - r.top;
} else {
x = e.pageX - r.left;
y = e.pageY - r.top;
}
}
o.prevX = o.prevX || x;
o.prevY = o.prevY || y;
dx = -1 * (x - o.prevX);
dy = -1 * (y - o.prevY);
o.prevX = x;
o.prevY = y;
return o.onMove(dx, dy);
};
};
})();
gestureZoomMove/onDragStart/onDragStart.ls
(function(){
return function(o){
return function(e){
var ref$;
if (e.cancelable) {
e.preventDefault();
}
o.isMoving = true;
delete o.prevX;
delete o.prevY;
return ref$ = o.prevZ, delete o.prevZ, ref$;
};
};
})();
gestureZoomMove/onGestureChange/onGestureChange.ls
(function(){
return function(o){
return function(e){
var w, dz;
if (e.cancelable) {
e.preventDefault();
}
w = o.lastGestureDivWidth * e.scale;
dz = w - o.o.divWidth;
return o.onZoom(dz, true);
};
};
})();
gestureZoomMove/onGestureStart/onGestureStart.ls
(function(){
return function(o){
return function(e){
if (e.cancelable) {
e.preventDefault();
}
if (!o.divWidth) {
o.divWidth = o.div.width();
}
return o.lastGestureDivWidth = o.divWidth;
};
};
})();
gestureZoomMove/onWheelChange/onWheelChange.ls
(function(){
return function(o){
return function(e){
var dx, dy, dz;
if (e.cancelable) {
e.preventDefault();
}
dx = e.deltaX;
dy = e.deltaY;
if (e.ctrlKey) {
dz = -1 * dy * 5;
return o.onZoom(dz);
} else {
return o.onMove(dx, dy, true);
}
};
};
})();