File tree Expand file tree Collapse file tree 3 files changed +42
-1
lines changed
java/com/flowingcode/vaadin/addons/imagecrop
resources/META-INF/frontend/styles Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
<groupId >com.flowingcode.vaadin.addons</groupId >
6
6
<artifactId >image-crop-addon</artifactId >
7
- <version >1.0.1 -SNAPSHOT</version >
7
+ <version >1.1.0 -SNAPSHOT</version >
8
8
<name >Image Crop Add-on</name >
9
9
<description >Image Crop Add-on for Vaadin Flow</description >
10
10
<url >https://www.flowingcode.com/en/open-source/</url >
Original file line number Diff line number Diff line change 46
46
@ JsModule ("./src/image-crop.tsx" )
47
47
@ Tag ("image-crop" )
48
48
@ CssImport ("react-image-crop/dist/ReactCrop.css" )
49
+ @ CssImport ("./styles/image-crop-styles.css" )
49
50
public class ImageCrop extends ReactAdapterComponent {
51
+
52
+ private static final String IMG_FULL_HEIGHT_CLASS_NAME = "img-full-height" ;
50
53
51
54
private String croppedImageDataUri ;
52
55
@@ -341,6 +344,21 @@ public String getCroppedImageDataUri() {
341
344
return this .croppedImageDataUri ;
342
345
}
343
346
347
+ /**
348
+ * Sets the image to occupy the full viewport height when enabled.
349
+ * If {@code fullHeight} is {@code true}, applies a CSS class that
350
+ * sets the image height to 100vh. If {@code false}, removes the class
351
+ * to revert to the default height.
352
+ *
353
+ * @param fullHeight whether the image should fill the viewport height
354
+ */
355
+ public void setImageFullHeight (Boolean fullHeight ) {
356
+ if (fullHeight )
357
+ this .addClassName (IMG_FULL_HEIGHT_CLASS_NAME );
358
+ else
359
+ this .removeClassName (IMG_FULL_HEIGHT_CLASS_NAME );
360
+ }
361
+
344
362
/**
345
363
* Decodes the cropped image data URI and returns it as a byte array. If the image data URI is not
346
364
* in the format "data:image/*;base64,", it will be decoded assuming it is a Base64 encoded
Original file line number Diff line number Diff line change
1
+ /*-
2
+ * #%L
3
+ * Image Crop Add-on
4
+ * %%
5
+ * Copyright (C) 2024 Flowing Code
6
+ * %%
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * #L%
19
+ */
20
+
21
+ .img-full-height img {
22
+ height : 100vh ;
23
+ };
You can’t perform that action at this time.
0 commit comments