diff --git a/projects/common/components/geometry/geometry.component.ts b/projects/common/components/geometry/geometry.component.ts index 3288f376ee36767331a6012ec10352b497ea626b..75bb4a455b1d3cb66bfa08bf7dcbe99ce82d2d9b 100644 --- a/projects/common/components/geometry/geometry.component.ts +++ b/projects/common/components/geometry/geometry.component.ts @@ -13,7 +13,10 @@ declare const GGBApplet: any; @Component({ selector: 'aspect-geometry', template: ` - <div class="geogebra-container"> + <div class="geogebra-container" + [style.height.px]="elementModel.height" + [style.width.px]="elementModel.width" + [class.center]="this.elementModel.position.fixedSize && this.elementModel.position.dynamicPositioning"> <div [id]="elementModel.id" class="geogebra-applet"></div> <button *ngIf="this.elementModel.showResetIcon" mat-icon-button @@ -27,8 +30,8 @@ declare const GGBApplet: any; `, styles: [ ':host {display: block; width: 100%; height: 100%;}', - '.geogebra-applet {margin: auto;}', '.geogebra-container {position: relative;}', + '.center {margin: auto;}', '.reset-button {position: absolute; right: 0; z-index: 100; margin: 5px;}', '.reset-icon {font-size: 30px !important;}' ] @@ -86,8 +89,9 @@ export class GeometryComponent extends ElementComponent implements AfterViewInit } const params: any = { id: this.elementModel.id, - width: this.elementModel.width, - height: this.elementModel.height, + width: this.elementModel.width - 4, // must be smaller than the container, otherwise scroll bars will be displayed + height: this.elementModel.height - 4, + scale: 1, showToolBar: this.elementModel.showToolbar, enableShiftDragZoom: this.elementModel.enableShiftDragZoom, showZoomButtons: this.elementModel.showZoomButtons, diff --git a/projects/common/models/elements/geometry/geometry.ts b/projects/common/models/elements/geometry/geometry.ts index 2f9786e7625ab39a8839995a47f88ef504b9b05e..0f8c0f287162b10926c42810d818a9df170633bc 100644 --- a/projects/common/models/elements/geometry/geometry.ts +++ b/projects/common/models/elements/geometry/geometry.ts @@ -31,7 +31,7 @@ export class GeometryElement extends UIElement implements PositionedUIElement { this.showFullscreenButton = element.showFullscreenButton !== undefined ? element.showFullscreenButton : true; this.customToolBar = element.customToolBar !== undefined ? element.customToolBar : ''; - this.position = UIElement.initPositionProps({ ...element.position, fixedSize: true }); // yes, always stay fixed + this.position = UIElement.initPositionProps({ ...element.position }); } getElementComponent(): Type<ElementComponent> {