mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
InvokeAsync to SendAsync.
This commit is contained in:
parent
b8b706e409
commit
df80db9407
@ -28,12 +28,12 @@ namespace Remotely.Agent.Services
|
||||
var rcBinaryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ScreenCast", OSUtils.ScreenCastExecutableFileName);
|
||||
if (!File.Exists(rcBinaryPath))
|
||||
{
|
||||
await hubConnection.InvokeAsync("DisplayMessage", "Chat executable not found on target device.", "Executable not found on device.", requesterID);
|
||||
await hubConnection.SendAsync("DisplayMessage", "Chat executable not found on target device.", "Executable not found on device.", requesterID);
|
||||
}
|
||||
|
||||
|
||||
// Start ScreenCast.
|
||||
await hubConnection.InvokeAsync("DisplayMessage", $"Starting chat service...", "Starting chat service.", requesterID);
|
||||
await hubConnection.SendAsync("DisplayMessage", $"Starting chat service...", "Starting chat service.", requesterID);
|
||||
if (OSUtils.IsWindows)
|
||||
{
|
||||
|
||||
@ -46,7 +46,7 @@ namespace Remotely.Agent.Services
|
||||
var result = Win32Interop.OpenInteractiveProcess($"{rcBinaryPath} -mode Chat -requester {requesterID} -organization \"{orgName}\"", "default", false, out var procInfo);
|
||||
if (!result)
|
||||
{
|
||||
await hubConnection.InvokeAsync("DisplayMessage", "Remote control failed to start on target device.", "Failed to start remote control.", requesterID);
|
||||
await hubConnection.SendAsync("DisplayMessage", "Remote control failed to start on target device.", "Failed to start remote control.", requesterID);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -63,7 +63,7 @@ namespace Remotely.Agent.Services
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Write(ex);
|
||||
await hubConnection.InvokeAsync("DisplayMessage", "Remote control failed to start on target device.", "Failed to start remote control.", requesterID);
|
||||
await hubConnection.SendAsync("DisplayMessage", "Remote control failed to start on target device.", "Failed to start remote control.", requesterID);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -75,13 +75,13 @@ namespace Remotely.Agent.Services
|
||||
var rcBinaryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ScreenCast", OSUtils.ScreenCastExecutableFileName);
|
||||
if (!File.Exists(rcBinaryPath))
|
||||
{
|
||||
await hubConnection.InvokeAsync("DisplayMessage", "Remote control executable not found on target device.", "Executable not found on device.", requesterID);
|
||||
await hubConnection.SendAsync("DisplayMessage", "Remote control executable not found on target device.", "Executable not found on device.", requesterID);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Start ScreenCast.
|
||||
await hubConnection.InvokeAsync("DisplayMessage", $"Starting remote control...", "Starting remote control.", requesterID);
|
||||
await hubConnection.SendAsync("DisplayMessage", $"Starting remote control...", "Starting remote control.", requesterID);
|
||||
if (OSUtils.IsWindows)
|
||||
{
|
||||
|
||||
@ -94,7 +94,7 @@ namespace Remotely.Agent.Services
|
||||
var result = Win32Interop.OpenInteractiveProcess(rcBinaryPath + $" -mode Unattended -requester {requesterID} -serviceid {serviceID} -deviceid {ConnectionInfo.DeviceID} -host {ConnectionInfo.Host}", "default", true, out _);
|
||||
if (!result)
|
||||
{
|
||||
await hubConnection.InvokeAsync("DisplayMessage", "Remote control failed to start on target device.", "Failed to start remote control.", requesterID);
|
||||
await hubConnection.SendAsync("DisplayMessage", "Remote control failed to start on target device.", "Failed to start remote control.", requesterID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,7 +107,7 @@ namespace Remotely.Agent.Services
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Write(ex);
|
||||
await hubConnection.InvokeAsync("DisplayMessage", "Remote control failed to start on target device.", "Failed to start remote control.", requesterID);
|
||||
await hubConnection.SendAsync("DisplayMessage", "Remote control failed to start on target device.", "Failed to start remote control.", requesterID);
|
||||
}
|
||||
}
|
||||
public async Task RestartScreenCaster(List<string> viewerIDs, string serviceID, string requesterID, HubConnection hubConnection)
|
||||
@ -140,8 +140,8 @@ namespace Remotely.Agent.Services
|
||||
if (!result)
|
||||
{
|
||||
Logger.Write("Failed to relaunch screen caster.");
|
||||
await hubConnection.InvokeAsync("SendConnectionFailedToViewers", viewerIDs);
|
||||
await hubConnection.InvokeAsync("DisplayMessage", "Remote control failed to start on target device.", "Failed to start remote control.", requesterID);
|
||||
await hubConnection.SendAsync("SendConnectionFailedToViewers", viewerIDs);
|
||||
await hubConnection.SendAsync("DisplayMessage", "Remote control failed to start on target device.", "Failed to start remote control.", requesterID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -154,7 +154,7 @@ namespace Remotely.Agent.Services
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await hubConnection.InvokeAsync("SendConnectionFailedToViewers", viewerIDs);
|
||||
await hubConnection.SendAsync("SendConnectionFailedToViewers", viewerIDs);
|
||||
Logger.Write(ex);
|
||||
throw;
|
||||
}
|
||||
|
||||
@ -32,11 +32,11 @@ namespace Remotely.Agent.Services
|
||||
if (Encoding.UTF8.GetBytes(serializedResult).Length > 400000)
|
||||
{
|
||||
await SendResultsViaAjax("PSCore", psCoreResult);
|
||||
await hubConnection.InvokeAsync("PSCoreResultViaAjax", commandID);
|
||||
await hubConnection.SendAsync("PSCoreResultViaAjax", commandID);
|
||||
}
|
||||
else
|
||||
{
|
||||
await hubConnection.InvokeAsync("PSCoreResult", psCoreResult);
|
||||
await hubConnection.SendAsync("PSCoreResult", psCoreResult);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -48,11 +48,11 @@ namespace Remotely.Agent.Services
|
||||
if (Encoding.UTF8.GetBytes(serializedResult).Length > 400000)
|
||||
{
|
||||
await SendResultsViaAjax("WinPS", result);
|
||||
await hubConnection.InvokeAsync("WinPSResultViaAjax", commandID);
|
||||
await hubConnection.SendAsync("WinPSResultViaAjax", commandID);
|
||||
}
|
||||
else
|
||||
{
|
||||
await hubConnection.InvokeAsync("CommandResult", result);
|
||||
await hubConnection.SendAsync("CommandResult", result);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -64,11 +64,11 @@ namespace Remotely.Agent.Services
|
||||
if (Encoding.UTF8.GetBytes(serializedResult).Length > 400000)
|
||||
{
|
||||
await SendResultsViaAjax("CMD", result);
|
||||
await hubConnection.InvokeAsync("CMDResultViaAjax", commandID);
|
||||
await hubConnection.SendAsync("CMDResultViaAjax", commandID);
|
||||
}
|
||||
else
|
||||
{
|
||||
await hubConnection.InvokeAsync("CommandResult", result);
|
||||
await hubConnection.SendAsync("CommandResult", result);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -80,11 +80,11 @@ namespace Remotely.Agent.Services
|
||||
if (Encoding.UTF8.GetBytes(serializedResult).Length > 400000)
|
||||
{
|
||||
await SendResultsViaAjax("Bash", result);
|
||||
await hubConnection.InvokeAsync("BashResultViaAjax", commandID);
|
||||
await hubConnection.SendAsync("BashResultViaAjax", commandID);
|
||||
}
|
||||
else
|
||||
{
|
||||
await hubConnection.InvokeAsync("CommandResult", result);
|
||||
await hubConnection.SendAsync("CommandResult", result);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -95,7 +95,7 @@ namespace Remotely.Agent.Services
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Write(ex);
|
||||
await hubConnection.InvokeAsync("DisplayMessage", "There was an error executing the command. It has been logged on the client device.", "Error executing command.", senderConnectionID);
|
||||
await hubConnection.SendAsync("DisplayMessage", "There was an error executing the command. It has been logged on the client device.", "Error executing command.", senderConnectionID);
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ namespace Remotely.Agent.Services
|
||||
break;
|
||||
}
|
||||
|
||||
await hubConnection.InvokeAsync("CommandResultViaApi", commandID, requestID);
|
||||
await hubConnection.SendAsync("CommandResultViaApi", commandID, requestID);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@ -58,7 +58,7 @@ namespace Remotely.Agent.Services
|
||||
|
||||
var device = await DeviceInformation.Create(ConnectionInfo.DeviceID, ConnectionInfo.OrganizationID);
|
||||
|
||||
var result = await HubConnection.InvokeAsync<bool>("DeviceCameOnline", device);
|
||||
var result = await HubConnection.SendAsync<bool>("DeviceCameOnline", device);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@ -75,17 +75,17 @@ namespace Remotely.Agent.Services
|
||||
{
|
||||
IsServerVerified = true;
|
||||
ConnectionInfo.ServerVerificationToken = Guid.NewGuid().ToString();
|
||||
await HubConnection.InvokeAsync("SetServerVerificationToken", ConnectionInfo.ServerVerificationToken);
|
||||
await HubConnection.SendAsync("SetServerVerificationToken", ConnectionInfo.ServerVerificationToken);
|
||||
ConfigService.SaveConnectionInfo(ConnectionInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
await HubConnection.InvokeAsync("SendServerVerificationToken");
|
||||
await HubConnection.SendAsync("SendServerVerificationToken");
|
||||
}
|
||||
|
||||
if (ConfigService.TryGetDeviceSetupOptions(out DeviceSetupOptions options))
|
||||
{
|
||||
await HubConnection.InvokeAsync("DeviceSetupOptions", options, ConnectionInfo.DeviceID);
|
||||
await HubConnection.SendAsync("DeviceSetupOptions", options, ConnectionInfo.DeviceID);
|
||||
}
|
||||
|
||||
HeartbeatTimer?.Dispose();
|
||||
@ -97,7 +97,7 @@ namespace Remotely.Agent.Services
|
||||
public async Task SendHeartbeat()
|
||||
{
|
||||
var currentInfo = await DeviceInformation.Create(ConnectionInfo.DeviceID, ConnectionInfo.OrganizationID);
|
||||
await HubConnection.InvokeAsync("DeviceHeartbeat", currentInfo);
|
||||
await HubConnection.SendAsync("DeviceHeartbeat", currentInfo);
|
||||
}
|
||||
|
||||
private async void HeartbeatTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
@ -176,7 +176,7 @@ namespace Remotely.Agent.Services
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.HubConnection.InvokeAsync("TransferCompleted", transferID, requesterID);
|
||||
await this.HubConnection.SendAsync("TransferCompleted", transferID, requesterID);
|
||||
});
|
||||
HubConnection.On("DeployScript", async (string mode, string fileID, string commandResultID, string requesterID) => {
|
||||
if (!IsServerVerified)
|
||||
|
||||
@ -9,7 +9,6 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Security.Principal;
|
||||
@ -20,7 +19,6 @@ using Remotely.ScreenCast.Core.Communication;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Remotely.Shared.Win32;
|
||||
using Screen = System.Windows.Forms.Screen;
|
||||
|
||||
namespace Remotely.Desktop.Win.ViewModels
|
||||
{
|
||||
|
||||
@ -208,7 +208,7 @@ namespace Remotely.ScreenCast.Core.Communication
|
||||
{
|
||||
if (conductor.Viewers.TryGetValue(viewerID, out var viewer) && viewer.HasControl)
|
||||
{
|
||||
await Connection.InvokeAsync("CtrlAltDel");
|
||||
await Connection.SendAsync("CtrlAltDel");
|
||||
}
|
||||
});
|
||||
|
||||
@ -217,7 +217,7 @@ namespace Remotely.ScreenCast.Core.Communication
|
||||
Logger.Write($"Disconnecting caster socket. Reason: {reason}");
|
||||
foreach (var viewer in conductor.Viewers.Values.ToList())
|
||||
{
|
||||
await Connection.InvokeAsync("ViewerDisconnected", viewer.ViewerConnectionID);
|
||||
await Connection.SendAsync("ViewerDisconnected", viewer.ViewerConnectionID);
|
||||
viewer.DisconnectRequested = true;
|
||||
}
|
||||
});
|
||||
@ -313,7 +313,7 @@ namespace Remotely.ScreenCast.Core.Communication
|
||||
|
||||
Connection.On("ViewerDisconnected", async (string viewerID) =>
|
||||
{
|
||||
await Connection.InvokeAsync("ViewerDisconnected", viewerID);
|
||||
await Connection.SendAsync("ViewerDisconnected", viewerID);
|
||||
if (conductor.Viewers.TryGetValue(viewerID, out var viewer))
|
||||
{
|
||||
viewer.DisconnectRequested = true;
|
||||
|
||||
@ -32,7 +32,10 @@ namespace Remotely.Server
|
||||
{
|
||||
if (OSUtils.IsWindows && enableEventLog)
|
||||
{
|
||||
logging.AddEventLog();
|
||||
logging.AddEventLog(settings => {
|
||||
settings.LogName = "Remotely_Server";
|
||||
settings.SourceName = "Remotely_Server";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -180,7 +180,9 @@ namespace Remotely.Server.Services
|
||||
if (Context?.User?.Identity?.IsAuthenticated == true)
|
||||
{
|
||||
orgId = DataService.GetUserByID(Context.UserIdentifier).OrganizationID;
|
||||
var currentUsers = RCDeviceSocketHub.SessionInfoList.Count(x => x.Value.OrganizationID == orgId);
|
||||
var currentUsers = RCDeviceSocketHub.SessionInfoList.Count(x =>
|
||||
x.Key != screenCasterID &&
|
||||
x.Value.OrganizationID == orgId);
|
||||
if (currentUsers >= AppConfig.RemoteControlSessionLimit)
|
||||
{
|
||||
await Clients.Caller.SendAsync("ShowMessage", "Max number of concurrent sessions reached.");
|
||||
|
||||
@ -18,7 +18,8 @@ button:active {
|
||||
}
|
||||
|
||||
button.toggled {
|
||||
background-color: rgb(120,120,120);
|
||||
background-color: rgb(220, 220, 220);
|
||||
color: black;
|
||||
}
|
||||
|
||||
button[disabled] {
|
||||
|
||||
@ -18,7 +18,8 @@ button:active {
|
||||
}
|
||||
|
||||
button.toggled {
|
||||
background-color: #60d8ff;
|
||||
background-color: #afecff;
|
||||
color: black;
|
||||
}
|
||||
|
||||
button[disabled] {
|
||||
|
||||
@ -10,6 +10,7 @@ export var ConnectButton = document.getElementById("connectButton");
|
||||
export var RequesterNameInput = document.getElementById("nameInput");
|
||||
export var StatusMessage = document.getElementById("statusMessage");
|
||||
export var ScreenViewer = document.getElementById("screenViewer");
|
||||
export var ScreenViewerWrapper = document.getElementById("screenViewerWrapper");
|
||||
export var Screen2DContext = ScreenViewer.getContext("2d");
|
||||
export var HorizontalBars = document.querySelectorAll(".horizontal-button-bar");
|
||||
export var ConnectBox = document.getElementById("connectBox");
|
||||
@ -45,7 +46,7 @@ var cancelNextViewerClick;
|
||||
var isPinchZooming;
|
||||
var startPinchPoint1;
|
||||
var startPinchPoint2;
|
||||
var startPinchDistance;
|
||||
var lastPinchDistance;
|
||||
var isMenuButtonDragging;
|
||||
var startMenuDraggingY;
|
||||
var startLongPressTimeout;
|
||||
@ -107,7 +108,6 @@ export function ApplyInputHandlers(sockets) {
|
||||
if (FitToScreenButton.classList.contains("toggled")) {
|
||||
ScreenViewer.style.removeProperty("max-width");
|
||||
ScreenViewer.style.removeProperty("max-height");
|
||||
ScreenViewer.style.width = "100%";
|
||||
}
|
||||
else {
|
||||
ScreenViewer.style.maxWidth = "unset";
|
||||
@ -247,7 +247,7 @@ export function ApplyInputHandlers(sockets) {
|
||||
if (currentTouchCount == 2) {
|
||||
startPinchPoint1 = { X: e.touches[0].pageX, Y: e.touches[0].pageY, IsEmpty: false };
|
||||
startPinchPoint2 = { X: e.touches[1].pageX, Y: e.touches[1].pageY, IsEmpty: false };
|
||||
startPinchDistance = GetDistanceBetween(startPinchPoint1.X, startPinchPoint1.Y, startPinchPoint2.X, startPinchPoint2.Y);
|
||||
lastPinchDistance = GetDistanceBetween(startPinchPoint1.X, startPinchPoint1.Y, startPinchPoint2.X, startPinchPoint2.Y);
|
||||
}
|
||||
isDragging = false;
|
||||
KeyboardButton.removeAttribute("hidden");
|
||||
@ -265,17 +265,22 @@ export function ApplyInputHandlers(sockets) {
|
||||
var pinchPoint1 = { X: e.touches[0].pageX, Y: e.touches[0].pageY, IsEmpty: false };
|
||||
var pinchPoint2 = { X: e.touches[1].pageX, Y: e.touches[1].pageY, IsEmpty: false };
|
||||
var pinchDistance = GetDistanceBetween(pinchPoint1.X, pinchPoint1.Y, pinchPoint2.X, pinchPoint2.Y);
|
||||
if (Math.abs(pinchDistance - startPinchDistance) > 5) {
|
||||
if (Math.abs(pinchDistance - lastPinchDistance) > 5) {
|
||||
isPinchZooming = true;
|
||||
if (FitToScreenButton.classList.contains("toggled")) {
|
||||
FitToScreenButton.click();
|
||||
}
|
||||
var currentWidth = Number(ScreenViewer.style.width.slice(0, -1));
|
||||
var newWidth = Math.max(100, currentWidth + (pinchDistance - startPinchDistance));
|
||||
currentWidth = newWidth;
|
||||
ScreenViewer.style.width = String(currentWidth) + "%";
|
||||
startPinchDistance = pinchDistance;
|
||||
// TODO: Scroll wrapper.
|
||||
var currentWidth = ScreenViewer.clientWidth;
|
||||
var currentHeight = ScreenViewer.clientHeight;
|
||||
var currentWidthPercent = Number(ScreenViewer.style.width.slice(0, -1));
|
||||
var newWidthPercent = Math.max(100, currentWidthPercent + (pinchDistance - lastPinchDistance));
|
||||
ScreenViewer.style.width = String(newWidthPercent) + "%";
|
||||
var heightChange = ScreenViewer.clientHeight - currentHeight;
|
||||
var widthChange = ScreenViewer.clientWidth - currentWidth;
|
||||
var scrollPercentX = ScreenViewerWrapper.scrollLeft / (ScreenViewerWrapper.scrollWidth - ScreenViewerWrapper.clientWidth);
|
||||
var scrollPercentY = ScreenViewerWrapper.scrollTop / (ScreenViewerWrapper.scrollHeight - ScreenViewerWrapper.clientHeight);
|
||||
ScreenViewerWrapper.scrollBy(widthChange * scrollPercentX, heightChange * scrollPercentY);
|
||||
lastPinchDistance = pinchDistance;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -13,6 +13,7 @@ export var ConnectButton = document.getElementById("connectButton") as HTMLButto
|
||||
export var RequesterNameInput = document.getElementById("nameInput") as HTMLInputElement;
|
||||
export var StatusMessage = document.getElementById("statusMessage") as HTMLDivElement;
|
||||
export var ScreenViewer = document.getElementById("screenViewer") as HTMLCanvasElement;
|
||||
export var ScreenViewerWrapper = document.getElementById("screenViewerWrapper") as HTMLDivElement;
|
||||
export var Screen2DContext = ScreenViewer.getContext("2d");
|
||||
export var HorizontalBars = document.querySelectorAll(".horizontal-button-bar");
|
||||
export var ConnectBox = document.getElementById("connectBox") as HTMLDivElement;
|
||||
@ -49,7 +50,7 @@ var cancelNextViewerClick: boolean;
|
||||
var isPinchZooming: boolean;
|
||||
var startPinchPoint1: Point;
|
||||
var startPinchPoint2: Point;
|
||||
var startPinchDistance: number;
|
||||
var lastPinchDistance: number;
|
||||
var isMenuButtonDragging: boolean;
|
||||
var startMenuDraggingY: number;
|
||||
var startLongPressTimeout: number;
|
||||
@ -112,7 +113,6 @@ export function ApplyInputHandlers(sockets: RCBrowserSockets) {
|
||||
if (FitToScreenButton.classList.contains("toggled")) {
|
||||
ScreenViewer.style.removeProperty("max-width");
|
||||
ScreenViewer.style.removeProperty("max-height");
|
||||
ScreenViewer.style.width = "100%";
|
||||
}
|
||||
else {
|
||||
ScreenViewer.style.maxWidth = "unset";
|
||||
@ -256,7 +256,7 @@ export function ApplyInputHandlers(sockets: RCBrowserSockets) {
|
||||
if (currentTouchCount == 2) {
|
||||
startPinchPoint1 = { X: e.touches[0].pageX, Y: e.touches[0].pageY, IsEmpty: false };
|
||||
startPinchPoint2 = { X: e.touches[1].pageX, Y: e.touches[1].pageY, IsEmpty: false };
|
||||
startPinchDistance = GetDistanceBetween(startPinchPoint1.X,
|
||||
lastPinchDistance = GetDistanceBetween(startPinchPoint1.X,
|
||||
startPinchPoint1.Y,
|
||||
startPinchPoint2.X,
|
||||
startPinchPoint2.Y);
|
||||
@ -285,17 +285,25 @@ export function ApplyInputHandlers(sockets: RCBrowserSockets) {
|
||||
pinchPoint2.X,
|
||||
pinchPoint2.Y);
|
||||
|
||||
if (Math.abs(pinchDistance - startPinchDistance) > 5) {
|
||||
if (Math.abs(pinchDistance - lastPinchDistance) > 5) {
|
||||
isPinchZooming = true;
|
||||
if (FitToScreenButton.classList.contains("toggled")) {
|
||||
FitToScreenButton.click();
|
||||
}
|
||||
var currentWidth = Number(ScreenViewer.style.width.slice(0, -1));
|
||||
var newWidth = Math.max(100, currentWidth + (pinchDistance - startPinchDistance));
|
||||
currentWidth = newWidth;
|
||||
ScreenViewer.style.width = String(currentWidth) + "%";
|
||||
startPinchDistance = pinchDistance;
|
||||
// TODO: Scroll wrapper.
|
||||
var currentWidth = ScreenViewer.clientWidth;
|
||||
var currentHeight = ScreenViewer.clientHeight;
|
||||
|
||||
var currentWidthPercent = Number(ScreenViewer.style.width.slice(0, -1));
|
||||
var newWidthPercent = Math.max(100, currentWidthPercent + (pinchDistance - lastPinchDistance));
|
||||
ScreenViewer.style.width = String(newWidthPercent) + "%";
|
||||
|
||||
var heightChange = ScreenViewer.clientHeight - currentHeight;
|
||||
var widthChange = ScreenViewer.clientWidth - currentWidth;
|
||||
var scrollPercentX = ScreenViewerWrapper.scrollLeft / (ScreenViewerWrapper.scrollWidth - ScreenViewerWrapper.clientWidth);
|
||||
var scrollPercentY = ScreenViewerWrapper.scrollTop / (ScreenViewerWrapper.scrollHeight - ScreenViewerWrapper.clientHeight);
|
||||
ScreenViewerWrapper.scrollBy(widthChange * scrollPercentX, heightChange * scrollPercentY);
|
||||
|
||||
lastPinchDistance = pinchDistance;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user