aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-06-10 10:53:57 -0400
committerbobzel <zzzman@gmail.com>2022-06-10 10:53:57 -0400
commit9c5d0fc25b14619bedf96a9988be4f8c254812c4 (patch)
tree4babd722fe15bd1cbc80a276897b55161c635358 /src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
parent7d38e4a98a0382cdd032d63d375707f19362873d (diff)
parent78b3b4f194b94a230ff0b07e397b595700d6529f (diff)
Merge branch 'master' into master-cleanup
Diffstat (limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx61
1 files changed, 37 insertions, 24 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index f4d2d55d5..99f74b8a2 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1500,15 +1500,22 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
}
}
if (oldDiv instanceof HTMLCanvasElement) {
- const canvas = oldDiv;
- const img = document.createElement('img'); // create a Image Element
- img.src = canvas.toDataURL(); //image source
- img.style.width = canvas.style.width;
- img.style.height = canvas.style.height;
- const newCan = newDiv as HTMLCanvasElement;
- const parEle = newCan.parentElement as HTMLElement;
- parEle.removeChild(newCan);
- parEle.appendChild(img);
+ if (oldDiv.className === "collectionFreeFormView-grid") {
+ const newCan = newDiv as HTMLCanvasElement;
+ const parEle = newCan.parentElement as HTMLElement;
+ parEle.removeChild(newCan);
+ parEle.appendChild(document.createElement('div'))
+ } else {
+ const canvas = oldDiv;
+ const img = document.createElement('img'); // create a Image Element
+ img.src = canvas.toDataURL(); //image source
+ img.style.width = canvas.style.width;
+ img.style.height = canvas.style.height;
+ const newCan = newDiv as HTMLCanvasElement;
+ const parEle = newCan.parentElement as HTMLElement;
+ parEle.removeChild(newCan);
+ parEle.appendChild(img);
+ }
}
}
@@ -1516,15 +1523,23 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
this.layoutDoc[Id] + "-icon" + (new Date()).getTime(),
this.props.docViewPath().lastElement().ContentDiv!,
this.layoutDoc[WidthSym](), this.layoutDoc[HeightSym](),
- this.props.PanelWidth(), this.props.PanelHeight(), 0,
+ this.props.PanelWidth(), this.props.PanelHeight(), 0, 1, false, "",
(iconFile, nativeWidth, nativeHeight) => {
- this.dataDoc.icon = new ImageField(iconFile);
- this.dataDoc["icon-nativeWidth"] = nativeWidth;
- this.dataDoc["icon-nativeHeight"] = nativeHeight;
+ this.dataDoc.icon = new ImageField(iconFile);
+ this.dataDoc["icon-nativeWidth"] = nativeWidth;
+ this.dataDoc["icon-nativeHeight"] = nativeHeight;
});
- public static UpdateIcon(filename:string, docViewContent:HTMLElement, width: number, height: number,
- panelWidth:number, panelHeight: number, scrollTop:number, cb:(iconFile:string, nativeWidth:number, nativeHeight:number) => any) {
+ public static UpdateIcon(
+ filename:string, docViewContent:HTMLElement,
+ width: number, height: number,
+ panelWidth:number, panelHeight: number,
+ scrollTop:number,
+ realNativeHeight: number,
+ noSuffix: boolean,
+ replaceRootFilename: string| undefined,
+ cb:(iconFile:string, nativeWidth:number, nativeHeight:number) => any)
+ {
const newDiv = docViewContent.cloneNode(true) as HTMLDivElement;
newDiv.style.width = width.toString();
newDiv.style.height = height.toString();
@@ -1532,19 +1547,17 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
const htmlString = new XMLSerializer().serializeToString(newDiv);
const nativeWidth = width;
const nativeHeight = height;
- CreateImage(
+ return CreateImage(
Utils.prepend(""),
document.styleSheets,
htmlString,
nativeWidth,
nativeWidth * panelHeight / panelWidth,
- scrollTop
+ scrollTop * panelHeight / realNativeHeight
).then
- ((data_url: any) => {
- VideoBox.convertDataUri(data_url, filename).then(
- returnedfilename => setTimeout(() => {
- cb(returnedfilename as string, nativeWidth, nativeHeight);
- }, 500));
+ (async (data_url: any) => {
+ const returnedFilename = await VideoBox.convertDataUri(data_url, filename, noSuffix, replaceRootFilename);
+ cb(returnedFilename as string, nativeWidth, nativeHeight);
})
.catch(function (error: any) {
console.error('oops, something went wrong!', error);
@@ -1773,7 +1786,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
isAnnotationOverlay={this.isAnnotationOverlay}>
<div className="marqueeView-div" ref={this._marqueeRef} style={{ opacity: this.props.dontRenderDocuments ? 0 : undefined }}>
{this.layoutDoc._backgroundGridShow ?
- <CollectionFreeFormBackgroundGrid
+ <div><CollectionFreeFormBackgroundGrid // bcz : UGHH don't know why, but if we don't wrap in a div, then PDF's don't render whenn taking snapshot of a dashboard and the background grid is on!!?
PanelWidth={this.props.PanelWidth}
PanelHeight={this.props.PanelHeight}
panX={this.panX}
@@ -1783,7 +1796,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
isAnnotationOverlay={this.isAnnotationOverlay}
cachedCenteringShiftX={this.cachedCenteringShiftX}
cachedCenteringShiftY={this.cachedCenteringShiftY}
- /> : (null)}
+ /></div> : (null)}
<CollectionFreeFormViewPannableContents
isAnnotationOverlay={this.isAnnotationOverlay}
isAnnotationOverlayScrollable={this.props.isAnnotationOverlayScrollable}