This commit is contained in:
Garrett K 2021-01-27 05:38:08 +00:00
parent 99bd8acc97
commit 2dd3632c4e
5 changed files with 40 additions and 11 deletions

View File

@ -584,6 +584,7 @@ function makeCabCloseClickable(){
function resizePathCanvas() {
$.each(pathArray, function(pathName, path){
var canvas = path['canvas'];
$(canvas).attr('width', $(canvas).parent().width());
$(canvas).attr('height', $(canvas).parent().height());
@ -627,10 +628,10 @@ function initializeCanvas() {
// Path connections
pathArray = {};
if($('#canvasPath').length) {
canvasPath = document.getElementById('canvasPath');
var canvas = $('#canvasPath');
pathArray['path'] = {
'context': canvasPath.getContext('2d'),
'canvas': $('#canvasPath'),
'context': $(canvas)[0].getContext('2d'),
'canvas': canvas,
'container' : $('#containerFullPath'),
'connections': {},
'trunks': {}
@ -638,3 +639,14 @@ function initializeCanvas() {
}
}
function initializeCanvasPathFinder(container) {
var canvas = $('#canvasPathFinder');
pathArray['pathFinder'] = {
'context': $(canvas)[0].getContext('2d'),
'canvas': canvas,
'container' : container,
'connections': {},
'trunks': {}
};
}

View File

@ -58,6 +58,7 @@ function clearSelectionDetails(){
function makeRackObjectsClickable(){
$('.port').click(function(event){
$(document).data('portClickedFlag', true);
var portIndex = $(this).data('portIndex');
@ -74,7 +75,13 @@ function makeRackObjectsClickable(){
if ($(document).data('portClickedFlag') === false) {
if ($(this).data('partitionType') == 'Connectable') {
// Default port selection
$(document).data('clickedObjPortID', 0);
// Draw cabinet connection path
$(document).data('selectedPort', $(this).find('.port').first());
drawCabinet();
} else {
$(document).data('clickedObjPortID', null);
}
@ -717,10 +724,9 @@ $( document ).ready(function() {
$('#printPathFinder ').on('click', function(event){
event.preventDefault();
$('#containerCablePath').printThis({
importStyle: true,
removeInline: true,
removeInlineSelector: "img"
$('#containerCablePath').parent().printThis({
canvas: true,
importStyle: true
});
});
@ -873,6 +879,9 @@ $( document ).ready(function() {
});
});
// Clear path connections
drawPath();
var table = '';
var pathID = 0;
$.each(responseJSON.success, function(pathType, pathTypeArray){
@ -906,12 +915,19 @@ $( document ).ready(function() {
if($(this).hasClass('tableRowHighlight')) {
$(this).removeClass('tableRowHighlight');
$('.containerCablePath').hide();
// Clear path connections
drawPath();
} else {
pathTable.$('tr.tableRowHighlight').removeClass('tableRowHighlight');
$(this).addClass('tableRowHighlight');
var pathIndex = $(this).attr('data-pathid');
$('.containerCablePath').hide();
$('#containerCablePath'+pathIndex).show();
// Draw path connections
initializeCanvasPathFinder($('#containerCablePath'+pathIndex));
drawPath();
}
});

View File

@ -304,7 +304,7 @@ $qls->Security->check_auth_page('user.php');
<blockquote class="card-blockquote">
<div class="row">
<!-- Canvas for drawing cabinet connections -->
<canvas id="canvasPath" class="connectionCanvas" style="z-index:1000;position:absolute; pointer-events:none;"></canvas>
<canvas id="canvasPath" style="z-index:1000;position:absolute; pointer-events:none;"></canvas>
<div id="containerFullPath"></div>
</div>
</blockquote>

View File

@ -18,7 +18,7 @@
<body>
<!-- Canvas for drawing cabinet connections -->
<canvas id="canvasCabinet" class="connectionCanvas" style="z-index:1000;position:absolute; pointer-events:none;"></canvas>
<canvas id="canvasCabinet" style="z-index:1000;position:absolute; pointer-events:none;"></canvas>
<?php require 'topbar.php'; ?>

View File

@ -161,6 +161,7 @@
</div>
<div class="card-block">
<blockquote class="card-blockquote">
<canvas id="canvasPathFinder" style="z-index:1000;position:absolute; pointer-events:none;"></canvas>
<div id="containerCablePath"></div>
</blockquote>
</div>