【发布时间】:2015-12-12 16:54:21
【问题描述】:
我需要一个小的工作区,但我的 FabricJS 画布需要一个大的输出,因为我正在将其转换为 PNG 用于印刷生产。我尝试了 CSS 技巧,你有一个大画布,但它看起来很小。
例子:
.canvas-container canvas {
width: 650px !important;
height: 436px !important;
border: 1px solid blue;
}
<div class="col-md-8 hidden-xs hidden-sm canvas-container">
<canvas id="c"></canvas>
</div>
但是,当我尝试这个时,它非常慢,并且画布的某些部分不响应 CSS。输出到页面后,代码如下:
<div class="col-md-8 hidden-xs hidden-sm canvas-container" style="z-index:2" ng-hide="showBoxPreviewContainer">
<div class="canvas-container" style="width: 25800px; height: 16743.7px; position: relative; -webkit-user-select: none;">
<canvas id="c" class="lower-canvas" width="25799" height="16743" style="position: absolute; width: 25800px; height: 16743.7px; left: 0px; top: 0px; -webkit-user-select: none;">
</canvas>
<canvas class="upper-canvas " width="25799" height="16743" style="position: absolute; width: 25800px; height: 16743.7px; left: 0px; top: 0px; -webkit-user-select: none; cursor: default;">
</canvas>
</div>
关于如何让 CSS 应用于 FabricJS 生成的所有这些元素或更好的任何想法,创建一个支持画布会更好/我该怎么做?
【问题讨论】: