aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ImageBox.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-06-12 23:33:21 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-06-12 23:33:21 -0400
commit37335c64be97502895d6fd80282daa8ef42a81a5 (patch)
tree2ef3cda0e5398c6da8cf1306150425df67e4cd6e /src/client/views/nodes/ImageBox.tsx
parent27efc9b078b3301ebf73a9ba7dc881bd354e71d9 (diff)
parenta638c12cde39a3ea5193a8038f72a55d706d9af8 (diff)
Merge branch 'master' into text_box_ab
Diffstat (limited to 'src/client/views/nodes/ImageBox.tsx')
-rw-r--r--src/client/views/nodes/ImageBox.tsx14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx
index 06ecc794b..0d19508fa 100644
--- a/src/client/views/nodes/ImageBox.tsx
+++ b/src/client/views/nodes/ImageBox.tsx
@@ -136,12 +136,15 @@ export class ImageBox extends DocComponent<FieldViewProps, ImageDocument>(ImageD
subitems.push({ description: "Copy path", event: () => Utils.CopyText(url), icon: "expand-arrows-alt" });
subitems.push({
description: "Rotate", event: action(() => {
- this.props.Document.rotation = (NumCast(this.props.Document.rotation) + 90) % 360;
+ let proto = Doc.GetProto(this.props.Document);
let nw = this.props.Document.nativeWidth;
- this.props.Document.nativeWidth = this.props.Document.nativeHeight;
- this.props.Document.nativeHeight = nw;
+ let nh = this.props.Document.nativeHeight;
let w = this.props.Document.width;
- this.props.Document.width = this.props.Document.height;
+ let h = this.props.Document.height;
+ proto.rotation = (NumCast(this.props.Document.rotation) + 90) % 360;
+ proto.nativeWidth = nh;
+ proto.nativeHeight = nw;
+ this.props.Document.width = h;
this.props.Document.height = w;
}), icon: "expand-arrows-alt"
});
@@ -198,6 +201,7 @@ export class ImageBox extends DocComponent<FieldViewProps, ImageDocument>(ImageD
let id = (this.props as any).id; // bcz: used to set id = "isExpander" in templates.tsx
let nativeWidth = FieldValue(this.Document.nativeWidth, pw);
+ let nativeHeight = FieldValue(this.Document.nativeHeight, 0);
let paths: string[] = ["http://www.cs.brown.edu/~bcz/noImage.png"];
// this._curSuffix = "";
// if (w > 20) {
@@ -211,7 +215,7 @@ export class ImageBox extends DocComponent<FieldViewProps, ImageDocument>(ImageD
let interactive = InkingControl.Instance.selectedTool ? "" : "-interactive";
let rotation = NumCast(this.props.Document.rotation, 0);
let aspect = (rotation % 180) ? this.props.Document[HeightSym]() / this.props.Document[WidthSym]() : 1;
- let shift = (rotation % 180) ? (this.props.Document[HeightSym]() - this.props.Document[WidthSym]() / aspect) / 2 : 0;
+ let shift = (rotation % 180) ? (nativeHeight - nativeWidth / aspect) / 2 : 0;
return (
<div id={id} className={`imageBox-cont${interactive}`}
onPointerDown={this.onPointerDown}