Skip to content

Commit fc1f971

Browse files
committed
Updates
1 parent 9aeb3de commit fc1f971

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

netbox_floorplan/static/netbox_floorplan/floorplan/edit.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,16 @@ window.center_pan_on_slected_object = center_pan_on_slected_object;
453453

454454
function update_background() {
455455
var assigned_image = document.getElementById("id_assigned_image").value;
456-
if (assigned_image == "") { assigned_image = null; }
456+
if (assigned_image == "") {
457+
assigned_image = null;
458+
canvas.setBackgroundImage(null, canvas.renderAll.bind(canvas));
459+
}
457460
var floor_json = canvas.toJSON(["id", "text", "_controlsVisibility", "custom_meta", "lockMovementY", "lockMovementX", "evented", "selectable"]);
458461

462+
463+
464+
465+
459466
$.ajax({
460467
type: "PATCH",
461468
url: `/api/plugins/floorplan/floorplans/${obj_pk}/`,
@@ -490,15 +497,13 @@ function update_background() {
490497
canvas.getObjects().forEach(function (object) {
491498
if (object.custom_meta) {
492499
if (object.custom_meta.object_type == "floorplan_boundry") {
493-
alert("found")
494500
left = object.left;
495501
top = object.top;
496502
width = object.width;
497503
height = object.height;
498504
}
499505
}
500506
});
501-
alert(height + ":" + width)
502507
// if we have a floorplan boundary, position the image in there
503508
if (height != 0 && width != 0) {
504509
let scaleRatioX = Math.max(width / img.width)

netbox_floorplan/static/netbox_floorplan/floorplan/utils.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,13 @@ function init_floor_plan(floorplan_id, canvas, mode) {
170170
canvas.getObjects().forEach(function (object) {
171171
if (object.custom_meta) {
172172
if (object.custom_meta.object_type == "floorplan_boundry") {
173-
alert("found")
174173
left = object.left;
175174
top = object.top;
176175
width = object.width;
177176
height = object.height;
178177
}
179178
}
180179
});
181-
alert(height + ":" + width)
182180
// if we have a floorplan boundary, position the image in there
183181
if (height != 0 && width != 0) {
184182
let scaleRatioX = Math.max(width / img.width)

0 commit comments

Comments
 (0)