|
36 | 36 | width: width * scale, |
37 | 37 | height: height * scale |
38 | 38 | }); |
39 | | - if (file.type === "image/svg+xml") { |
| 39 | + if (!["image/jpeg", "image/png"].includes(file.type)) { |
40 | 40 | canvas.toBlob(blob => { |
41 | 41 | dispatch("update", { |
42 | 42 | file: blob |
|
107 | 107 | .operation { |
108 | 108 | background-color: rgba(0, 0, 0, 0.3); |
109 | 109 | } |
| 110 | + .resize-border { |
| 111 | + @apply absolute border-dashed border-gray-600; |
| 112 | + } |
| 113 | + .resize-corner { |
| 114 | + @apply absolute w-10 h-10 bg-blue-300 rounded-full; |
| 115 | + } |
110 | 116 | </style> |
111 | 117 |
|
112 | 118 | <svelte:options immutable={true} /> |
|
125 | 131 | class:operation> |
126 | 132 | <div |
127 | 133 | data-direction="left" |
128 | | - class="absolute left-0 top-0 h-full w-1 border-l border-dashed |
129 | | - border-gray-600 cursor-ew-resize" /> |
| 134 | + class="resize-border h-full w-1 left-0 top-0 border-l cursor-ew-resize" /> |
130 | 135 | <div |
131 | 136 | data-direction="top" |
132 | | - class="absolute left-0 top-0 w-full h-1 border-t border-dashed |
133 | | - border-gray-600 cursor-ns-resize" /> |
| 137 | + class="resize-border w-full h-1 left-0 top-0 border-t cursor-ns-resize" /> |
134 | 138 | <div |
135 | 139 | data-direction="bottom" |
136 | | - class="absolute left-0 bottom-0 w-full h-1 border-b border-dashed |
137 | | - border-gray-600 cursor-ns-resize" /> |
| 140 | + class="resize-border w-full h-1 left-0 bottom-0 border-b cursor-ns-resize" /> |
138 | 141 | <div |
139 | 142 | data-direction="right" |
140 | | - class="absolute right-0 top-0 h-full w-1 border-r border-dashed |
141 | | - border-gray-600 cursor-ew-resize" /> |
| 143 | + class="resize-border h-full w-1 right-0 top-0 border-r cursor-ew-resize" /> |
142 | 144 | <div |
143 | 145 | data-direction="left-top" |
144 | | - class="absolute left-0 top-0 w-5 h-5 bg-blue-300 rounded-full |
145 | | - cursor-nwse-resize transform -translate-x-1/2 -translate-y-1/2 md:scale-50" /> |
| 146 | + class="resize-corner left-0 top-0 cursor-nwse-resize transform |
| 147 | + -translate-x-1/2 -translate-y-1/2 md:scale-25" /> |
146 | 148 | <div |
147 | 149 | data-direction="right-top" |
148 | | - class="absolute right-0 top-0 w-5 h-5 bg-blue-300 rounded-full |
149 | | - cursor-nesw-resize transform translate-x-1/2 -translate-y-1/2 md:scale-50" /> |
| 150 | + class="resize-corner right-0 top-0 cursor-nesw-resize transform |
| 151 | + translate-x-1/2 -translate-y-1/2 md:scale-25" /> |
150 | 152 | <div |
151 | 153 | data-direction="left-bottom" |
152 | | - class="absolute left-0 bottom-0 w-5 h-5 bg-blue-300 rounded-full |
153 | | - cursor-nesw-resize transform -translate-x-1/2 translate-y-1/2 md:scale-50" /> |
| 154 | + class="resize-corner left-0 bottom-0 cursor-nesw-resize transform |
| 155 | + -translate-x-1/2 translate-y-1/2 md:scale-25" /> |
154 | 156 | <div |
155 | 157 | data-direction="right-bottom" |
156 | | - class="absolute right-0 bottom-0 w-5 h-5 bg-blue-300 rounded-full |
157 | | - cursor-nwse-resize transform translate-x-1/2 translate-y-1/2 md:scale-50" /> |
| 158 | + class="resize-corner right-0 bottom-0 cursor-nwse-resize transform |
| 159 | + translate-x-1/2 translate-y-1/2 md:scale-25" /> |
158 | 160 | </div> |
159 | 161 | <canvas class="w-full h-full" bind:this={canvas} /> |
160 | 162 | </div> |
0 commit comments