hey so we have a custom fabric canvas and when the user flips the object to set flipX to true, the control corner MTR or the border for MTR is misplaced.
before
after
the object is flipped by scaling. I've tried to manually set flipX to false when object was scaled and that seemed to fix it, but it caused the object to not be flipped.
here is all the code in our codebase related to control corners, I believe we're not changing or setting anything to cause such a break, but I'm not sure what's causing it either.
import { FabricObject, ProductConfig } from "../../../../types"
import { isText } from "./general"
const applyDefaultCosmeticAttributes = (
obj: FabricObject,
productConfig?: ProductConfig
) => {
obj.set({
borderColor: "#FFEE0B",
editingBorderColor: "#FFEE0B",
cornerColor: "#000000",
cornerSize: 8,
borderScaleFactor: 2,
transparentCorners: false,
hoverCursor: "pointer",
snapAngle: 5,
})
if (productConfig) {
if (
productConfig.rotatable !== undefined &&
productConfig.rotatable !== null
) {
obj.setControlVisible("mtr", productConfig.rotatable)
}
if (
productConfig.scalable !== undefined &&
productConfig.scalable !== null
) {
obj.setControlsVisibility({
bl: productConfig.scalable,
br: productConfig.scalable,
mb: productConfig.scalable,
ml: productConfig.scalable,
mr: productConfig.scalable,
mt: productConfig.scalable,
tl: productConfig.scalable,
tr: productConfig.scalable,
})
}
}
if (obj.width === 0 && obj.height === 0) {
obj.setControlsVisibility({
bl: false,
br: false,
mb: false,
ml: false,
mr: false,
mt: false,
tl: false,
tr: false,
mtr: false,
})
}
obj.on("mouseover", function (this: FabricObject) {
const activeObject = this.canvas.getActiveObject()
if (activeObject) if (activeObject.key === obj.key) return
this._renderControls(this.canvas.contextTop, {
borderColor: "#FFEE0B",
hasRotatingPoint: false,
hasControls: false,
})
})
obj.on("mousedown", function (this: FabricObject) {
this.canvas.clearContext(this.canvas.contextTop)
})
obj.on("mouseout", function (this: FabricObject) {
this.canvas.clearContext(this.canvas.contextTop)
})
}
export default applyDefaultCosmeticAttributes
Related
The situation is that of the image:
This is the code (see click event):
private initRegionsLayer() {
const layer = new GeoJSON(this.regions, {
style: (feature) =>
this.styleService.regionsStyleMaker(feature, this.data, this.type),
onEachFeature: (feature, layer) => {
layer.on({
mouseover: (e) =>
this.highlightShapeService.highlightShape(e, feature, this.data),
mouseout: (e) => this.highlightShapeService.resetShape(e),
click: (e) => {
e.target.setStyle({
stroke: false,
})
},
});
const foundRecord = this.data.find(
(item: { regione: any }) =>
feature.properties['Regione'] === item.regione
);
if (foundRecord) {
layer.bindTooltip(this.popupService.regionsPopup(foundRecord), {
direction: 'right',
permanent: false,
sticky: true,
offset: [20, 0],
opacity: 0.9,
});
}
},
});
Even if I try to set "stroke" to "false", nothing happens.
How to solve? Thanks!
Set myMarker = {};
void _onMapCreated(GoogleMapController controller) {
.
controller.setMapStyle(MapsStyle.mapStyle);
setState(() {
myMarker.add(const Marker(
markerId: MarkerId('id-1'),
position: LatLng(24.411358, 39.590044),
infoWindow: InfoWindow(
title: 'test',
snippet: 'test',
),
));
});
}
GoogleMap(
mapType: MapType.normal,
zoomGesturesEnabled: true,
compassEnabled: true,
myLocationEnabled: true,
myLocationButtonEnabled: true,
initialCameraPosition: const CameraPosition(
target: LatLng(24.411358, 39.590044),
zoom: 15,
),
onMapCreated: _onMapCreated,
markers: myMarker,
)
enter image description here
i am using highcharts-export-server for export charts and send it to Email in PDF format
while i am trying to export that in localy it was working fine, but on live server when i am trying to export all the charts data-labels disappear.
this is the image from which was exporting from live server.
and here is the image which was exporting locally.
Here is my Code
exports.getPieChartImg = (seriesData, xOrLength, innersize, showLegend, width, height) => {
var chartOpts = {
chart: {
type: 'pie',
width: width,
height: height,
},
plotOptions: {
pie: {
innerSize: innersize || 80,
depth: 25,
allowPointSelect: true,
dataLabels: {
enabled: false,
format: '<b>{point.name}</b>: {point.percentage:.2f} %'
},
showInLegend: showLegend || false,
},
series: {
stacking: 'normal',
dataLabels: {
enabled: true,
color: '#6f6f6f',
format: '{point.percentage:.2f}',
crop: false,
overflow: "none",
},
pointWidth: 30,
}
},
legend: {
labelFormat: '<b>{name}</b> ({percentage:.2f})%',
useHTML: true,
},
series: [{
data: seriesData
}]
};
var exportSettings = generateExportSettings(chartOpts, 'Pie');
return generateBase64Chart(exportSettings)
}
function generateExportSettings(chartOpts, constr) {
return {
// b64: true,
instr: JSON.stringify(chartOpts),
noDownload: true,
constr,
globalOptions: {
colors: ['#3BB9DA', '#0F89A8', '#0B8F8B', '#1DB1AD', '#68E3DF', '#FFB469', '#F58B1F', '#D16900', '#FC3C3C', '#FF6666', '#FC8D8D', '#FCC0C0'],
lang: {
thousandsSep: ','
}
},
scale: false,
styledMode: false,
type: "image/png",
width: false,
};
}
function generateBase64Chart(exportSettings) {
return new Promise((resolve, reject) => {
highchartsExporter.export(exportSettings, function (err, res) {
if (err) {
return reject({
code: '1',
err,
msg: 'Error in stock chart',
exportSettings
})
}
return resolve({
code: '0',
msg: 'success',
data: 'data:image/png;base64,' + res.data,
})
});
})
}
remove node_module and reInstall it again.
and if not installed libfontconfig then install 'sudo apt-get install libfontconfig'
I have an ASP.net MVC solution and use jqGrid in it. To have a better performance I use loadonce: false as an option and it should be in this way, unfortunately It seems to be not supported by jqGrid because I cannot find any sign of that throughout my search.
$(document).ready(function () {
$("#jqGrid").jqGrid(
{
url: "/Student/GetStudents",
mtype: "GET",
datatype: "json",
contentType: "application/json; charset-utf-8",
jsonReader: {
root: "rows",
id: "StudentId",
repeatitems: false
},
colNames: ['StudentId', 'FirstName', 'LastName'],
colModel: [
{ label: 'StudentId', name: 'Id', key: true, width: 75 },
{ label: 'FirstName', name: 'FirstName', width: 150 },
{ label: 'LastName', name: 'LastName', width: 150 },
],
viewrecords: true,
loadonce: false,
width: '100%',
height: 'auto',
rowNum: 20,
rowList: [20, 30, 50],
sortable: true,
sortname: 'Id',
pager: "#jqGridPager",
autoencode: true,
scroll: false,
pgbuttons: true,
autowidth: true,
shrinkToFit: false,
forceFit: false,
gridview: false,
height: '100%',
scrollrows: true,
page: 1,
//pagerpos: 'center',
toppager: true,
recordpos: 'right',
multiselect: true,
multiboxonly: true,
direction: 'rtl',
ignoreCase: true,
caption: "",
rownumbers: true
});
$('#jqGrid').jqGrid('navGrid', '#jqGridPager', {
search: true,
searchtext: "Search",
edit: false,
add: false,
del: false,
excel: true,
refresh: false,
}, {}, {}, {}, {
closeOnEscape: true,
closeAfterSearch: true,
ignoreCase: true,
multipleSearch: false,
multipleGroup: false,
showQuery: false,
sopt: ['cn', 'eq', 'ne'],
defaultSearch: 'cn'
})
$('#jqGrid').jqGrid('navButtonAdd', '#jqGridPager', {
caption: "Export to Excel",
//buttonicon: "ui-icon-disk",
buttonicon: "ui-icon-folder-open",
onClickButton: function () {
exportToExcel();
},
});
});
function exportToExcel(data, e) {
exportExcelFile(data);
}
function exportExcelFile() {
debugger;
var data = $('#jqGrid')[0].addLocalData(true);
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
frame1.document.open("txt/html", "replace");
frame1.document.write(setTableOfData(data));
frame1.document.close();
frame1.focus();
sa = frame1.document.execCommand("SaveAs", true, "text.xls");
} else
$('#jqGrid').jqGrid('exportToExcel', { fileName: "exportedExcel.xls", navigator: true });
}
function setTableOfData(data) {
var htmlString = '<table>';
var header = '<tr><td>StudentId</td><td>FirstName</td><td>LastName</td></tr>';
htmlString += header;
for (var i = 0; i < data.length; i++) {
var tag = '<tr><td>' + data[i].Id + '</td><td>' + data[i].FirstName + '</td><td>' + data[i].LastName + '</td></tr>';
htmlString += tag;
}
htmlString += '</table>';
return htmlString;
}
Finally, I forced to post all the filtering and other settings of the grid to the server and return a link to the client. Then with the given link I became able to download the excel file.
Info: you can not download a file with post(ajax) request.
I am using jQgrid - and it is great!
I have one problem.
(Oleg are you still around?)
In the search/filter form (were you can choose the coulmn you want to filter and the operation you want do to), the only things that comes up is the "contain" operator.
My colModel looks like this:
var columnModel = [{ name: 'ID', index: 'ID', sortable: true, searchoptions: { sopt: ['eq', 'cn','bw']}},
{ name: 'FirstName', index: 'FirstName', sortable: true},
{ name: 'LastName', index: 'LastName', sortable: true }
];
But it only gives me the contains operator.
The full grid is like this:
myGrid.jqGrid({
url: './ViewNQueryData.asmx/ViewNQueryData',
datatype: 'json',
mtype: 'POST',
postData: {userID:currentUserId, sphereID:currentSphereId},
ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
serializeGridData: function (postData)
{
if (postData.filters === undefined) postData.filters = null;
return JSON.stringify(postData);
},
jsonReader: {
root: function (obj) { return obj.d.rows; },
page: function (obj) { return obj.d.page; },
total: function (obj) { return obj.d.total; },
records: function (obj) { return obj.d.records; }
},
colModel: columnModel,
colNames: columnNames,
rowNum: 10,
rowList: [10, 20, 300],
sortable: true,
pager: "#ViewNQueryPager",
viewrecords: true,
gridview: true,
height: 250,
shrinkToFit: true, //If using frozen coulmns change to false.
gridComplete: function ()
{
$('#totalRecordsFound').html(myGrid.jqGrid('getGridParam', 'records') + " Customers");
},
loadError: function ()
{
alert("Error fetching data");
}
}).jqGrid('navGrid', '#ViewNQueryPager',
{ edit: false, add: false, del: false, search: true, view: true }, //option
{}, // use default settings for edit
{}, // use default settings for add
{}, // delete instead that del:false we need this
{multipleSearch: true, multipleGroup: true, showQuery: true, onSearch: function (response) { showQueryDetails(); } },
{ height: 250, jqModal: false, closeOnEscape: true} // view options
);
Can any one help me with this???
Fixed!
I had a snippet of code on my page that was doing this....