cropping png

This commit is contained in:
10001shh
2019-01-11 14:42:19 -06:00
parent 07f0ed43e3
commit 24110adcf3
2 changed files with 20 additions and 13 deletions

View File

@@ -43,7 +43,6 @@ Colors: Use the following - https://www.google.com/design/spec/style/color.html#
opacity: 0; opacity: 0;
border: none; border: none;
} }
/* Styling for each event from Schedule */ /* Styling for each event from Schedule */
.fc-time-grid-event.fc-v-event.fc-event { .fc-time-grid-event.fc-v-event.fc-event {
@@ -55,6 +54,9 @@ Colors: Use the following - https://www.google.com/design/spec/style/color.html#
opacity: 1; opacity: 1;
} }
.html2canvas-container { width: 3000px !important; height: 3000px !important; }
.fc-time-grid-event.fc-v-event.fc-event:hover { .fc-time-grid-event.fc-v-event.fc-event:hover {
box-shadow: 0 8px 12px 0 rgba(0, 0, 0, 0.3); box-shadow: 0 8px 12px 0 rgba(0, 0, 0, 0.3);
} }
@@ -72,7 +74,7 @@ Colors: Use the following - https://www.google.com/design/spec/style/color.html#
.fc th { .fc th {
border-style: ridge !important; border-style: ridge !important;
border-width: 1px !important; border-width: 1px !important;
padding: 2px 3px 2px 3px !important; padding: 4px 3px 0px 3px !important;
vertical-align: top !important; vertical-align: top !important;
border-left-width: 0; border-left-width: 0;

View File

@@ -108,12 +108,17 @@ $(function () {
window.open(currLink); window.open(currLink);
}, butdelay); }, butdelay);
}); });
console.log($("#calendar").width());
$("#save").click(() => { $("#save").click(() => {
html2canvas(document.querySelector("#calendar"), { let cropper = document.createElement('canvas').getContext('2d');
foreignObjectRendering: true html2canvas(document.getElementById("calendar"), {
}).then(canvas => { foreignObjectRendering: true,
}).then(c => {
cropper.canvas.width = $("#calendar").width();
cropper.canvas.height = $("#calendar").height() + 10;
cropper.drawImage(c, 0, 0);
var a = document.createElement('a'); var a = document.createElement('a');
a.href = canvas.toDataURL("image/png"); a.href = cropper.canvas.toDataURL("image/png");
a.download = 'mySchedule.png'; a.download = 'mySchedule.png';
a.click(); a.click();
}); });
@@ -178,7 +183,7 @@ $(function () {
var description = title.substring(title.indexOf('with')); var description = title.substring(title.indexOf('with'));
var time = event.start._d.toUTCString(); var time = event.start._d.toUTCString();
cal.addEvent(classname, description, event.building, event.start._i, event.end._i, { cal.addEvent(classname, description, event.building, event.start._i, event.end._i, {
rrule: `RRULE:FREQ=WEEKLY;BYDAY=${time.substring(0, time.indexOf(",")-1).toUpperCase()};INTERVAL=1` rrule: `RRULE:FREQ=WEEKLY;BYDAY=${time.substring(0, time.indexOf(",") - 1).toUpperCase()};INTERVAL=1`
}); });
} }
cal.download("My_Course_Calendar"); cal.download("My_Course_Calendar");